diff --git a/packages/ui/src/components/session/SessionSidebar.tsx b/packages/ui/src/components/session/SessionSidebar.tsx index fcb8461f..078ef2e4 100644 --- a/packages/ui/src/components/session/SessionSidebar.tsx +++ b/packages/ui/src/components/session/SessionSidebar.tsx @@ -450,9 +450,8 @@ const SessionSidebarComponent: React.FC = ({ const archivedSessionStructure = useGlobalSessionsStore(useShallow( (state) => state.archivedSessions.map(getSessionStructuralSignature).sort(), )); - const globalSessionSnapshot = useGlobalSessionsStore.getState(); - const globalActiveSessions = globalSessionSnapshot.activeSessions; - const archivedSessions = globalSessionSnapshot.archivedSessions; + const globalActiveSessions = useGlobalSessionsStore((state) => state.activeSessions); + const archivedSessions = useGlobalSessionsStore((state) => state.archivedSessions); const liveFallbackCacheRef = React.useRef<{ signature: string; sessions: Session[] }>({ signature: '', sessions: [], @@ -553,6 +552,13 @@ const SessionSidebarComponent: React.FC = ({ void refreshGlobalSessions(syncSessionsSnapshotRef.current); }, []); + React.useEffect(() => { + const interval = window.setInterval(() => { + void refreshGlobalSessions(); + }, 45_000); + return () => window.clearInterval(interval); + }, []); + React.useEffect(() => { let cancelled = false;