diff --git a/web/src/lib/components/layout/LeftSidebar.svelte b/web/src/lib/components/layout/LeftSidebar.svelte index 6596bec..4d1c1f8 100644 --- a/web/src/lib/components/layout/LeftSidebar.svelte +++ b/web/src/lib/components/layout/LeftSidebar.svelte @@ -158,15 +158,15 @@ })); const folderCounts = $derived(folderCountsQuery.data ?? {}); - // Root count = total photos minus the sum of every subfolder count. - // `config.count.all` is PhotoPrism's authoritative library total - // (kept in sync server-side); subtracting non-root photos gives an - // exact root-only count without a separate API trip. - const rootCount = $derived.by(() => { - const total = configQuery.data?.count?.all ?? 0; - const sub = Object.values(folderCounts).reduce((a, b) => a + b, 0); - return Math.max(0, total - sub); - }); + // Root entry shows the whole library — see applyFolderScope() on / + // timeline. PhotoPrism's `count.all` from /api/v1/config is the + // authoritative library total (kept in sync server-side), so use it + // directly. Earlier this subtracted Σ(folderCounts) from total, which + // worked when folderCounts were direct-child only; now that the + // sidecar fan-out recurses (see handlers_folders.go), every photo + // gets summed once per ancestor — the subtraction would double-count + // and drive rootCount to 0. + const rootCount = $derived(configQuery.data?.count?.all ?? 0); const createMut = createMutation(() => ({ mutationFn: (title: string) => createHeap(title),