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