fix: show recent sessions in project groups

Keeps Recent as an extra shortcut list
Restores sessions under their project and worktree groups
This commit is contained in:
Bohdan Triapitsyn
2026-06-03 14:51:17 +03:00
parent 8e25bc4cce
commit a0b22c9960
@@ -1039,45 +1039,13 @@ export const SessionSidebar: React.FC<SessionSidebarProps> = ({
});
const sectionsForSidebarRender = React.useMemo(() => {
const archiveFilteredSections = showArchivedSessions
return showArchivedSessions
? sectionsForRender
: sectionsForRender.map((section) => ({
...section,
groups: section.groups.filter((group) => !group.isArchivedBucket),
}));
if (isVSCode || hasSessionSearchQuery || recentSessionIds.size === 0) {
return archiveFilteredSections;
}
const filterNodes = (nodes: SessionNode[]): SessionNode[] => {
return nodes.reduce<SessionNode[]>((acc, node) => {
if (recentSessionIds.has(node.session.id)) {
return acc;
}
const filteredChildren = filterNodes(node.children);
if (filteredChildren.length === node.children.length) {
acc.push(node);
return acc;
}
acc.push({
...node,
children: filteredChildren,
});
return acc;
}, []);
};
return archiveFilteredSections.map((section) => ({
...section,
groups: section.groups.map((group) => ({
...group,
sessions: filterNodes(group.sessions),
})),
}));
}, [isVSCode, hasSessionSearchQuery, recentSessionIds, sectionsForRender, showArchivedSessions]);
}, [sectionsForRender, showArchivedSessions]);
const prLookupKeys = React.useMemo(() => {
const keys = new Set<string>();