Two related sidebar UX bugs.
1. Parent folders weren't clickable
renderTreeItem's onClick called toggleExpanded(item.id) for any
row with children — so a parent folder only expanded/collapsed,
never applied its filter. Restructured: folder rows always call
applyLibraryNode (which the photos endpoint already expands to
include descendants), and the chevron remains a separate
stopPropagation button for expansion. Other group headers
(Library, Folders, Tags) still toggle expansion on row click
since they have no associated filter.
Result: clicking any folder at any depth filters the timeline
to that folder + every descendant, matching the Lightroom
model the user expects.
2. New files not appearing after Scan all folders
scanLibraryMutation.onSettled invalidated ['photos'] when the
trigger returned, but POST /library/scan just queues the celery
task and returns immediately. By the time the worker finishes
walking the directory and inserting new rows, the photos query
has already refetched (with no new data) and is sitting on a
30-second staleTime — so newly-indexed photos stayed invisible
until the next manual refetch.
Fix: ScanProgress already polls /library/scan/status. Track the
previous is_scanning value via a ref; when it transitions from
true → false, invalidate ['photos'], ['folders'], ['folders',
'tree'], ['heaps'], and ['tags']. That's the actual moment new
data is available, regardless of how the scan was triggered
(button, watcher, startup).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>