|
43 | 43 | import { projectStateStore } from './lib/stores/projectState.svelte'; |
44 | 44 | import { initBloxEnv } from './lib/stores/bloxEnv.svelte'; |
45 | 45 | import { listenForSessionStatus } from './lib/listeners/sessionStatusListener'; |
| 46 | + import { listenForCacheInvalidation } from './lib/listeners/cacheInvalidationListener'; |
| 47 | + import { listenForPageLifecycle } from './lib/listeners/pageLifecycleListener'; |
46 | 48 | import { darkMode } from './lib/stores/isDark.svelte'; |
47 | 49 | import * as prPollingService from './lib/services/prPollingService'; |
48 | 50 | import { projectsList } from './lib/features/projects/projectsSidebarState.svelte'; |
|
61 | 63 | let unlistenZoomOut: UnlistenFn | undefined; |
62 | 64 | let unlistenZoomReset: UnlistenFn | undefined; |
63 | 65 | let unlistenSessionStatus: UnlistenFn | undefined; |
| 66 | + let unlistenCacheInvalidation: UnlistenFn | undefined; |
| 67 | + let unlistenPageLifecycle: (() => void) | undefined; |
64 | 68 | let unregisterShortcuts: (() => void) | null = null; |
65 | 69 | let stopUpdaterLoop: (() => void) | null = null; |
66 | 70 | let storeIncompat = $state<StoreIncompatibility | null>(null); |
|
86 | 90 | const projectId = navigation.selectedProjectId; |
87 | 91 | if (!projectId) return; |
88 | 92 | try { |
89 | | - const branches = await commands.listBranchesForProject(projectId); |
| 93 | + const { data: branches } = await commands.listBranchesForProject(projectId); |
90 | 94 | await Promise.allSettled(branches.map((b) => commands.refreshBranchGitState(b.id))); |
91 | 95 | } catch { |
92 | 96 | // best-effort refresh; ignore failures |
|
228 | 232 | darkMode.init(); |
229 | 233 | document.addEventListener('keydown', handleKonamiKey); |
230 | 234 |
|
| 235 | + // Web resume accelerator: the restored project id is available synchronously |
| 236 | + // (navigation seeds it from localStorage at module load). Warm that project's |
| 237 | + // branch timelines in parallel right away so cards find data ready, rather |
| 238 | + // than each doing its own serialized IndexedDB read after ProjectHome mounts. |
| 239 | + if (navigation.selectedProjectId) { |
| 240 | + void commands.warmProjectTimelines(navigation.selectedProjectId); |
| 241 | + } |
| 242 | +
|
231 | 243 | // Listen for the app menu Preferences item. |
232 | 244 | unlistenSettings = listenToEvent('menu:settings', () => { |
233 | 245 | if (!triggerShortcut('app-open-settings')) openSettings(); |
|
254 | 266 | // Global session-status listener — must live at App level so it works |
255 | 267 | // regardless of which view the user is on. See sessionStatusListener.ts. |
256 | 268 | unlistenSessionStatus = listenForSessionStatus(); |
| 269 | + unlistenCacheInvalidation = listenForCacheInvalidation(); |
| 270 | + unlistenPageLifecycle = listenForPageLifecycle(); |
257 | 271 |
|
258 | 272 | try { |
259 | 273 | await initPreferences(); |
|
422 | 436 | unlistenZoomOut?.(); |
423 | 437 | unlistenZoomReset?.(); |
424 | 438 | unlistenSessionStatus?.(); |
| 439 | + unlistenCacheInvalidation?.(); |
| 440 | + unlistenPageLifecycle?.(); |
425 | 441 | stopUpdaterLoop?.(); |
426 | 442 | }); |
427 | 443 |
|
|
0 commit comments