diff options
| author | Adam <[email protected]> | 2026-03-27 20:26:57 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-03-28 01:26:57 +0000 |
| commit | f736116967f5b57d89978e51961f2e78eedb443b (patch) | |
| tree | eac11218e8114d8d0f14c1b133b2c0594721f11c /packages/app/src/context/global-sync | |
| parent | 82fc493520925cb71323964bff6939e768e6d83a (diff) | |
| download | opencode-f736116967f5b57d89978e51961f2e78eedb443b.tar.gz opencode-f736116967f5b57d89978e51961f2e78eedb443b.zip | |
fix(app): more startup efficiency (#19454)
Diffstat (limited to 'packages/app/src/context/global-sync')
| -rw-r--r-- | packages/app/src/context/global-sync/bootstrap.ts | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/packages/app/src/context/global-sync/bootstrap.ts b/packages/app/src/context/global-sync/bootstrap.ts index 869f8b7ea..cf104ad97 100644 --- a/packages/app/src/context/global-sync/bootstrap.ts +++ b/packages/app/src/context/global-sync/bootstrap.ts @@ -43,8 +43,10 @@ function waitForPaint() { const timer = setTimeout(finish, 50) if (typeof requestAnimationFrame !== "function") return requestAnimationFrame(() => { - clearTimeout(timer) - finish() + setTimeout(() => { + clearTimeout(timer) + finish() + }, 0) }) }) } @@ -89,12 +91,6 @@ export async function bootstrapGlobal(input: { const fast = [ () => retry(() => - input.globalSDK.path.get().then((x) => { - input.setGlobalStore("path", x.data!) - }), - ), - () => - retry(() => input.globalSDK.global.config.get().then((x) => { input.setGlobalStore("config", x.data!) }), @@ -110,6 +106,12 @@ export async function bootstrapGlobal(input: { const slow = [ () => retry(() => + input.globalSDK.path.get().then((x) => { + input.setGlobalStore("path", x.data!) + }), + ), + () => + retry(() => input.globalSDK.project.list().then((x) => { const projects = (x.data ?? []) .filter((p) => !!p?.id) @@ -221,12 +223,16 @@ export async function bootstrapDirectory(input: { if (loading) input.setStore("status", "partial") const fast = [ + () => retry(() => input.sdk.app.agents().then((x) => input.setStore("agent", normalizeAgentList(x.data)))), + () => retry(() => input.sdk.config.get().then((x) => input.setStore("config", x.data!))), + () => retry(() => input.sdk.session.status().then((x) => input.setStore("session_status", x.data!))), + ] + + const slow = [ () => seededProject ? Promise.resolve() : retry(() => input.sdk.project.current()).then((x) => input.setStore("project", x.data!.id)), - () => retry(() => input.sdk.app.agents().then((x) => input.setStore("agent", normalizeAgentList(x.data)))), - () => retry(() => input.sdk.config.get().then((x) => input.setStore("config", x.data!))), () => seededPath ? Promise.resolve() @@ -237,7 +243,6 @@ export async function bootstrapDirectory(input: { if (next) input.setStore("project", next) }), ), - () => retry(() => input.sdk.session.status().then((x) => input.setStore("session_status", x.data!))), () => retry(() => input.sdk.vcs.get().then((x) => { @@ -299,9 +304,6 @@ export async function bootstrapDirectory(input: { ) }), ), - ] - - const slow = [ () => Promise.resolve(input.loadSessions(input.directory)), () => retry(() => |
