fix(folders): root shows whole library + sidecar counts recurse

Two paired fixes for the folder tree on the timeline:

* +page.svelte: drop the `Path === ''` post-filter for the root entry.
  PhotoPrism's indexer always nests photos under YYYY/MM, so "photos
  whose Path is empty" is always the empty set in practice — the root
  entry looked broken instead of "whole library". Treat `/` as the
  unscoped view and rely on subfolder selections (now wildcarded via
  filters.svelte.ts) for narrowing.

* sidecar/handlers_folders.go: the per-folder count fan-out used
  `q=path:<x>`, the same exact-match operator that just got fixed in
  the web filter. Result: every year-level folder reported count=0
  in the sidebar. Switch to `q=path:"<x>*"` so the count reflects
  the whole subtree (dedupe by UID still in place).
This commit is contained in:
Claudio
2026-05-17 23:25:43 +02:00
parent 8083328f2d
commit 505fef5dfc
2 changed files with 21 additions and 11 deletions

View File

@@ -177,12 +177,14 @@
// scoped server-side via the q-DSL and must not be re-filtered here,
// or labels / search will silently drop subfolder photos when the
// store hasn't fully hydrated from the URL yet.
//
// Root (`/`) historically also restricted to `Path === ''` — i.e.
// photos sitting directly at the originals root with no subfolder.
// PhotoPrism's indexer however always nests photos under YYYY/MM, so
// that view was always empty in practice. Treat root as "the whole
// library" instead; subfolders still scope normally.
function applyFolderScope(list: PpPhoto[], f: typeof filters): PpPhoto[] {
if (f.folderPath !== '/') return list;
if (f.section !== 'all-photos') return list;
if (f.heapUid) return list;
if (f.search) return list;
return list.filter((p) => !p.Path);
return list;
}
const pageCount = $derived(photosQuery.data?.pages.length ?? 0);