fix: preserve chat folder assignments on reload

Prevents folder cleanup before sessions finish loading
Keeps saved chat folder memberships after desktop reload
This commit is contained in:
Bohdan Triapitsyn
2026-06-05 20:58:54 +03:00
parent 3bfb7ba6aa
commit 48b0a4f292
2 changed files with 5 additions and 1 deletions
@@ -848,6 +848,7 @@ export const SessionSidebar: React.FC<SessionSidebarProps> = ({
const isSessionsLoading = useSessionUIStore((state) => state.isLoading);
useSessionFolderCleanup({
isSessionsLoading,
hasLoadedGlobalSessions,
sessions,
archivedSessions,
normalizedProjects,
@@ -12,6 +12,7 @@ type WorktreeMeta = { path: string };
type Args = {
isSessionsLoading: boolean;
hasLoadedGlobalSessions: boolean;
sessions: Session[];
archivedSessions: Session[];
normalizedProjects: NormalizedProject[];
@@ -23,6 +24,7 @@ type Args = {
export const useSessionFolderCleanup = (args: Args): void => {
const {
isSessionsLoading,
hasLoadedGlobalSessions,
sessions,
archivedSessions,
normalizedProjects,
@@ -32,7 +34,7 @@ export const useSessionFolderCleanup = (args: Args): void => {
} = args;
React.useEffect(() => {
if (isSessionsLoading) {
if (isSessionsLoading || !hasLoadedGlobalSessions) {
return;
}
@@ -86,6 +88,7 @@ export const useSessionFolderCleanup = (args: Args): void => {
archivedSessions,
availableWorktreesByProject,
cleanupSessions,
hasLoadedGlobalSessions,
isSessionsLoading,
isVSCode,
normalizedProjects,