summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDax Raad <[email protected]>2025-11-09 01:41:49 -0500
committerDax Raad <[email protected]>2025-11-09 01:41:49 -0500
commit4b7231be68fb5ac9bf25657f8f39c7e349a63a5d (patch)
tree753a3762e4a4cab9c68913039dcb7012ed54656c
parent70a6fe96ea8e16566c44123f8b7ce4c3e78604f4 (diff)
downloadopencode-4b7231be68fb5ac9bf25657f8f39c7e349a63a5d.tar.gz
opencode-4b7231be68fb5ac9bf25657f8f39c7e349a63a5d.zip
fix race condition
-rw-r--r--packages/opencode/src/cli/cmd/tui/context/sync.tsx31
1 files changed, 15 insertions, 16 deletions
diff --git a/packages/opencode/src/cli/cmd/tui/context/sync.tsx b/packages/opencode/src/cli/cmd/tui/context/sync.tsx
index 0dc04af2e..e53cd60b9 100644
--- a/packages/opencode/src/cli/cmd/tui/context/sync.tsx
+++ b/packages/opencode/src/cli/cmd/tui/context/sync.tsx
@@ -221,23 +221,22 @@ export const { use: useSync, provider: SyncProvider } = createSimpleContext({
sdk.client.app.agents().then((x) => setStore("agent", x.data ?? [])),
sdk.client.config.get().then((x) => setStore("config", x.data!)),
]).then(() => {
- if (store.status === "loading") setStore("status", "partial")
- })
-
- // non-blocking
- Promise.all([
- sdk.client.session.list().then((x) =>
- setStore(
- "session",
- (x.data ?? []).toSorted((a, b) => a.id.localeCompare(b.id)),
+ setStore("status", "partial")
+ // non-blocking
+ Promise.all([
+ sdk.client.session.list().then((x) =>
+ setStore(
+ "session",
+ (x.data ?? []).toSorted((a, b) => a.id.localeCompare(b.id)),
+ ),
),
- ),
- sdk.client.command.list().then((x) => setStore("command", x.data ?? [])),
- sdk.client.lsp.status().then((x) => setStore("lsp", x.data!)),
- sdk.client.mcp.status().then((x) => setStore("mcp", x.data!)),
- sdk.client.formatter.status().then((x) => setStore("formatter", x.data!)),
- ]).then(() => {
- setStore("status", "complete")
+ sdk.client.command.list().then((x) => setStore("command", x.data ?? [])),
+ sdk.client.lsp.status().then((x) => setStore("lsp", x.data!)),
+ sdk.client.mcp.status().then((x) => setStore("mcp", x.data!)),
+ sdk.client.formatter.status().then((x) => setStore("formatter", x.data!)),
+ ]).then(() => {
+ setStore("status", "complete")
+ })
})
const result = {