fix(sessions): centralize global polling

This commit is contained in:
Bohdan Triapitsyn
2026-08-22 02:49:45 +03:00
parent c232d358da
commit 80068c634d
7 changed files with 88 additions and 30 deletions
@@ -543,22 +543,6 @@ const SessionSidebarComponent: React.FC<SessionSidebarProps> = ({
const isWorktreeTopologyLoading = !isVSCode && resolvedWorktreeTopologyKey !== projectWorktreeDiscoveryKey;
const [unresolvedWorktreeProjectPaths, setUnresolvedWorktreeProjectPaths] = React.useState<ReadonlySet<string>>(new Set());
const initialGlobalSessionsRefreshStartedRef = React.useRef(false);
React.useEffect(() => {
if (initialGlobalSessionsRefreshStartedRef.current) {
return;
}
initialGlobalSessionsRefreshStartedRef.current = true;
void refreshGlobalSessions(syncSessionsSnapshotRef.current);
}, []);
React.useEffect(() => {
const interval = window.setInterval(() => {
void refreshGlobalSessions();
}, 45_000);
return () => window.clearInterval(interval);
}, []);
React.useEffect(() => {
let cancelled = false;