feat: hide empty smart folders in sidebar

Smart folders with zero matching emails are not rendered once
sidebar counts have loaded. Folders still show while counts are
pending (avoids flash of empty sidebar on load).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
cesnimda
2026-06-30 20:45:48 +02:00
parent 21606c5f91
commit 0dfd739430
+4 -2
View File
@@ -203,8 +203,10 @@ export default function Layout() {
return fmtCount(item.countKey ? counts?.[item.countKey] : null); return fmtCount(item.countKey ? counts?.[item.countKey] : null);
}; };
// Smart folders sorted by count desc // Smart folders sorted by count desc; hide empty ones once counts have loaded
const sortedSmart = [...SMART_FOLDERS].sort((a, b) => { const sortedSmart = [...SMART_FOLDERS]
.filter((f) => !counts || (counts.smartFolders?.[f.slug] ?? 0) > 0)
.sort((a, b) => {
const ca = counts?.smartFolders?.[a.slug] ?? 0; const ca = counts?.smartFolders?.[a.slug] ?? 0;
const cb = counts?.smartFolders?.[b.slug] ?? 0; const cb = counts?.smartFolders?.[b.slug] ?? 0;
return cb - ca; return cb - ca;