perf: batch label stats query + fix scoped thumb

This commit is contained in:
dtoro
2026-06-07 00:33:23 +02:00
parent 3757eb0170
commit 86e38e152d
2 changed files with 43 additions and 18 deletions

View File

@@ -713,7 +713,9 @@ export async function listLabels(): Promise<PpLabel[]> {
const { data } = await sidecar.get<PpLabel[]>('/api/sidecar/labels', {
params: { count: 1000, order: 'count', all: true, perPage: 1000 }
});
return filterByUserPhotos(data, (l) => `label:${l.Slug}`);
// Sidecar already filters to the user's scope and sets correct counts +
// thumbs in one DB query — no need to probe each label individually.
return data;
}
// ── Subjects (people / face recognition) ────────────────────────────────────