Browse Source

fix structured cloning

Sebastian Herrlinger 3 days ago
parent
commit
c3e4352c21

+ 2 - 1
packages/opencode/src/cli/cmd/tui/context/prompt.tsx

@@ -1,4 +1,5 @@
 import { createSimpleContext } from "./helper"
+import { unwrap } from "solid-js/store"
 import type { PromptRef } from "../component/prompt"
 import type { PromptInfo } from "../component/prompt/history"
 
@@ -12,7 +13,7 @@ export function sessionScope(sessionID: string) {
 }
 
 function clone(prompt: PromptInfo) {
-  return structuredClone(prompt)
+  return structuredClone(unwrap(prompt))
 }
 
 function empty(prompt?: PromptInfo) {

+ 2 - 2
packages/opencode/src/cli/cmd/tui/context/route.tsx

@@ -1,4 +1,4 @@
-import { createStore } from "solid-js/store"
+import { createStore, reconcile } from "solid-js/store"
 import { createSimpleContext } from "./helper"
 import type { PromptInfo } from "../component/prompt/history"
 
@@ -37,7 +37,7 @@ export const { use: useRoute, provider: RouteProvider } = createSimpleContext({
         return store
       },
       navigate(route: Route) {
-        setStore(route)
+        setStore(reconcile(route))
       },
     }
   },