fix(sidebar): paginate folder counts; drop bogus all:true from labels query
Two distinct bugs were causing left-sidebar badges to under-report: 1. sidecar/folders/counts hard-capped each PP /photos call at count=1000 and deduped UIDs from that single page. Any folder with >1000 file rows under it (typical for a multi-year root scan with HEIC sidecars) silently lost everything past row 1000. On this library the root badge reported 912 while the year subfolders summed to 1175. Loop offsets instead, breaking when PP returns a short page. 2. The Labels-badge query passed all:true label:* to PP, which 400s with "Unable to do that" - none of the other bucket queries prefix all:true. Drop it; the scoped() helper already injects the user's path clause when applicable. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -143,7 +143,7 @@
|
||||
// BasePath shape and never fall back to the category-count.
|
||||
const labelsCountQuery = createQuery<number>(() => ({
|
||||
queryKey: ['photos', 'scoped-count', 'labels', userBasePath(), isAdminUser],
|
||||
queryFn: () => countPhotos(scoped('all:true label:*')),
|
||||
queryFn: () => countPhotos(scoped('label:*')),
|
||||
enabled: isAuthenticated(),
|
||||
staleTime: 60_000
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user