@@ -10,7 +10,7 @@ import type {
1010import { showToast } from "@opencode-ai/ui/toast"
1111import { getFilename } from "@opencode-ai/shared/util/path"
1212import { batch , createContext , getOwner , onCleanup , onMount , type ParentProps , untrack , useContext } from "solid-js"
13- import { createStore , produce , reconcile } from "solid-js/store"
13+ import { createStore , produce , reconcile , unwrap } from "solid-js/store"
1414import { useLanguage } from "@/context/language"
1515import { Persist , persisted } from "@/utils/persist"
1616import type { InitError } from "../pages/error"
@@ -95,13 +95,8 @@ function createGlobalSync() {
9595 )
9696 }
9797
98- const setProjects = ( next : Project [ ] | ( ( draft : Project [ ] ) => void ) ) => {
98+ const setProjects = ( next : Project [ ] | ( ( draft : Project [ ] ) => Project [ ] ) ) => {
9999 projectWritten = true
100- if ( typeof next === "function" ) {
101- setGlobalStore ( "project" , produce ( next ) )
102- cacheProjects ( )
103- return
104- }
105100 setGlobalStore ( "project" , next )
106101 cacheProjects ( )
107102 }
@@ -116,7 +111,7 @@ function createGlobalSync() {
116111
117112 const set = ( ( ...input : unknown [ ] ) => {
118113 if ( input [ 0 ] === "project" && ( Array . isArray ( input [ 1 ] ) || typeof input [ 1 ] === "function" ) ) {
119- setProjects ( input [ 1 ] as Project [ ] | ( ( draft : Project [ ] ) => void ) )
114+ setProjects ( input [ 1 ] as Project [ ] | ( ( draft : Project [ ] ) => Project [ ] ) )
120115 return input [ 1 ]
121116 }
122117 return ( setGlobalStore as ( ...args : unknown [ ] ) => unknown ) ( ...input )
0 commit comments