summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAiden Cline <[email protected]>2026-01-17 14:41:42 -0600
committerAiden Cline <[email protected]>2026-01-17 14:41:42 -0600
commitf3513bacffc83355369ccf5b7e8c264dc764d901 (patch)
tree217be100ff8a691331d76bc51ecc42a041372b65
parent3aff88c23d139f47af7f4db7bbc14e08a30f3b6e (diff)
downloadopencode-f3513bacffc83355369ccf5b7e8c264dc764d901.tar.gz
opencode-f3513bacffc83355369ccf5b7e8c264dc764d901.zip
tui: fix model state persistence when model store is not ready
-rw-r--r--packages/opencode/src/cli/cmd/tui/context/local.tsx9
1 files changed, 9 insertions, 0 deletions
diff --git a/packages/opencode/src/cli/cmd/tui/context/local.tsx b/packages/opencode/src/cli/cmd/tui/context/local.tsx
index 63f1d9743..d058ce54f 100644
--- a/packages/opencode/src/cli/cmd/tui/context/local.tsx
+++ b/packages/opencode/src/cli/cmd/tui/context/local.tsx
@@ -113,8 +113,16 @@ export const { use: useLocal, provider: LocalProvider } = createSimpleContext({
})
const file = Bun.file(path.join(Global.Path.state, "model.json"))
+ const state = {
+ pending: false,
+ }
function save() {
+ if (!modelStore.ready) {
+ state.pending = true
+ return
+ }
+ state.pending = false
Bun.write(
file,
JSON.stringify({
@@ -135,6 +143,7 @@ export const { use: useLocal, provider: LocalProvider } = createSimpleContext({
.catch(() => {})
.finally(() => {
setModelStore("ready", true)
+ if (state.pending) save()
})
const args = useArgs()