feat: enhance session activity tracking with directory support and cooldown logic

This commit is contained in:
Bohdan Triapitsyn
2025-12-25 02:38:38 +02:00
parent b806b01c29
commit 5e6e6a91cf
5 changed files with 439 additions and 115 deletions
+22 -1
View File
@@ -376,9 +376,30 @@ export const useSessionStore = create<SessionStore>()(
const validSessionIds = new Set(dedupedSessions.map((session) => session.id));
const resolveSelectionDirectory = (sessionId: string | null): string | null => {
if (!sessionId) {
return null;
}
const sessionDir = getSessionDirectory(dedupedSessions, sessionId);
if (sessionDir) {
return sessionDir;
}
const persistedDir = getSessionDirectory(stateSnapshot.sessions, sessionId);
if (persistedDir) {
return persistedDir;
}
return null;
};
const selectionDirectoryKey = resolveSelectionDirectory(nextCurrentId) ?? normalizedProject ?? projectDirectory ?? null;
if (projectDirectory) {
clearInvalidSessionSelection(projectDirectory, validSessionIds);
const storedSelection = getStoredSessionForDirectory(projectDirectory);
}
if (selectionDirectoryKey) {
clearInvalidSessionSelection(selectionDirectoryKey, validSessionIds);
const storedSelection = getStoredSessionForDirectory(selectionDirectoryKey);
if (storedSelection && validSessionIds.has(storedSelection)) {
nextCurrentId = storedSelection;
}