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:
@@ -203,12 +203,14 @@ 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]
|
||||||
const ca = counts?.smartFolders?.[a.slug] ?? 0;
|
.filter((f) => !counts || (counts.smartFolders?.[f.slug] ?? 0) > 0)
|
||||||
const cb = counts?.smartFolders?.[b.slug] ?? 0;
|
.sort((a, b) => {
|
||||||
return cb - ca;
|
const ca = counts?.smartFolders?.[a.slug] ?? 0;
|
||||||
});
|
const cb = counts?.smartFolders?.[b.slug] ?? 0;
|
||||||
|
return cb - ca;
|
||||||
|
});
|
||||||
|
|
||||||
const isPinnedSmart = (slug) => favSlugs.includes(slug);
|
const isPinnedSmart = (slug) => favSlugs.includes(slug);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user