diff options
| author | Martin Kagamino Lehoux <martin@lehoux.net> | 2026-07-29 15:04:07 +0200 |
|---|---|---|
| committer | Martin Kagamino Lehoux <martin@lehoux.net> | 2026-07-29 15:04:07 +0200 |
| commit | 6c7bed11fe771c20620ea9ff3152be7eb2695ffa (patch) | |
| tree | c15c51f34d13b1eb07642a759da260530b66ab67 /src/routes/+page.svelte | |
| parent | 627f748e4bf2ec5b36fe9641018f55b6d54a67e1 (diff) | |
fix: hide empty categories in the list view
Diffstat (limited to 'src/routes/+page.svelte')
| -rw-r--r-- | src/routes/+page.svelte | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index a395658..57f912d 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -20,10 +20,9 @@ const key = item.categoryName ?? 'Non catégorisé'; (groups[key] ??= []).push(item); } - const result: [string, typeof localItems][] = data.categories.map((cat) => [ - cat.name, - groups[cat.name] ?? [], - ]); + const result: [string, typeof localItems][] = data.categories + .filter((cat) => groups[cat.name]?.length > 0) + .map((cat) => [cat.name, groups[cat.name]]); if (groups['Non catégorisé']?.length > 0) { result.push(['Non catégorisé', groups['Non catégorisé']]); } |
