diff options
| author | Filip <[email protected]> | 2026-02-17 16:49:20 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-02-17 21:19:20 +0530 |
| commit | 46739ca7cd970cf84f88c3f0cf5ca8b756b64f7d (patch) | |
| tree | 77c7ec866966d7d9982921da8a8b2d0beab390d0 | |
| parent | d055c1cad6b46bee80909d1feffc87be14598e00 (diff) | |
| download | opencode-46739ca7cd970cf84f88c3f0cf5ca8b756b64f7d.tar.gz opencode-46739ca7cd970cf84f88c3f0cf5ca8b756b64f7d.zip | |
fix(app): ui flashing when switching tabs (#13978)
| -rw-r--r-- | packages/app/src/context/global-sdk.tsx | 4 | ||||
| -rw-r--r-- | packages/app/src/context/global-sync/bootstrap.ts | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/packages/app/src/context/global-sdk.tsx b/packages/app/src/context/global-sdk.tsx index c7f7708e6..82e39ed69 100644 --- a/packages/app/src/context/global-sdk.tsx +++ b/packages/app/src/context/global-sdk.tsx @@ -102,8 +102,10 @@ export const { use: useGlobalSDK, provider: GlobalSDKProvider } = createSimpleCo let attempt: AbortController | undefined const HEARTBEAT_TIMEOUT_MS = 15_000 + let lastEventAt = Date.now() let heartbeat: ReturnType<typeof setTimeout> | undefined const resetHeartbeat = () => { + lastEventAt = Date.now() if (heartbeat) clearTimeout(heartbeat) heartbeat = setTimeout(() => { attempt?.abort() @@ -118,6 +120,7 @@ export const { use: useGlobalSDK, provider: GlobalSDKProvider } = createSimpleCo void (async () => { while (!abort.signal.aborted) { attempt = new AbortController() + lastEventAt = Date.now() const onAbort = () => { attempt?.abort() } @@ -182,6 +185,7 @@ export const { use: useGlobalSDK, provider: GlobalSDKProvider } = createSimpleCo const onVisibility = () => { if (typeof document === "undefined") return if (document.visibilityState !== "visible") return + if (Date.now() - lastEventAt < HEARTBEAT_TIMEOUT_MS) return attempt?.abort() } if (typeof document !== "undefined") { diff --git a/packages/app/src/context/global-sync/bootstrap.ts b/packages/app/src/context/global-sync/bootstrap.ts index 478bc02f5..40a30cba8 100644 --- a/packages/app/src/context/global-sync/bootstrap.ts +++ b/packages/app/src/context/global-sync/bootstrap.ts @@ -116,7 +116,7 @@ export async function bootstrapDirectory(input: { vcsCache: VcsCache loadSessions: (directory: string) => Promise<void> | void }) { - input.setStore("status", "loading") + if (input.store.status !== "complete") input.setStore("status", "loading") const blockingRequests = { project: () => input.sdk.project.current().then((x) => input.setStore("project", x.data!.id)), |
