fix: hide empty archived section and folders (#872)

* fix: hide archived section and empty folders when no sessions remain

- Only push archived group in useSessionGrouping when there are archived
  sessions, preventing an empty archived section from rendering
- Hide empty folders in archived bucket via shouldKeepFolder check in
  SessionGroupSection (folders with no sessions and no content in
  children are filtered out)
- Always filter folders through shouldKeepFolder, not just during search

* perf: memoize archived folder filtering
This commit is contained in:
jwcrystal
2026-04-11 23:25:33 +03:00
committed by GitHub
parent 36b2bcf4f9
commit 5ea2fed0d3
2 changed files with 67 additions and 26 deletions
@@ -219,18 +219,21 @@ export const useSessionGrouping = (args: Args) => {
});
});
groups.push({
id: 'archived',
label: 'archived',
branch: null,
description: 'Archived and unassigned sessions',
isMain: false,
isArchivedBucket: true,
worktree: null,
directory: null,
folderScopeKey: !args.isVSCode && normalizedProjectRoot ? getArchivedScopeKey(normalizedProjectRoot) : null,
sessions: groupedNodes.get(archivedKey) ?? [],
});
const archivedSessions = groupedNodes.get(archivedKey) ?? [];
if (archivedSessions.length > 0) {
groups.push({
id: 'archived',
label: 'archived',
branch: null,
description: 'Archived and unassigned sessions',
isMain: false,
isArchivedBucket: true,
worktree: null,
directory: null,
folderScopeKey: !args.isVSCode && normalizedProjectRoot ? getArchivedScopeKey(normalizedProjectRoot) : null,
sessions: archivedSessions,
});
}
return groups;
},