diff --git a/frontend/src/components/Layout.jsx b/frontend/src/components/Layout.jsx index e445815..fa3c0f8 100644 --- a/frontend/src/components/Layout.jsx +++ b/frontend/src/components/Layout.jsx @@ -203,12 +203,14 @@ export default function Layout() { return fmtCount(item.countKey ? counts?.[item.countKey] : null); }; - // Smart folders sorted by count desc - const sortedSmart = [...SMART_FOLDERS].sort((a, b) => { - const ca = counts?.smartFolders?.[a.slug] ?? 0; - const cb = counts?.smartFolders?.[b.slug] ?? 0; - return cb - ca; - }); + // Smart folders sorted by count desc; hide empty ones once counts have loaded + const sortedSmart = [...SMART_FOLDERS] + .filter((f) => !counts || (counts.smartFolders?.[f.slug] ?? 0) > 0) + .sort((a, b) => { + const ca = counts?.smartFolders?.[a.slug] ?? 0; + const cb = counts?.smartFolders?.[b.slug] ?? 0; + return cb - ca; + }); const isPinnedSmart = (slug) => favSlugs.includes(slug);