Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/opencode/src/cli/cmd/tui/context/project.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const { use: useProject, provider: ProjectProvider } = createSimpleContex
name: "Project",
init: () => {
const sdk = useSDK()
let sync_seqnr = 0
const [store, setStore] = createStore({
project: {
id: undefined as string | undefined,
Expand All @@ -30,13 +31,15 @@ export const { use: useProject, provider: ProjectProvider } = createSimpleContex
},
})

async function sync() {
async function sync(seqnr = ++sync_seqnr) {
const workspace = store.workspace.current
const [path, project] = await Promise.all([
sdk.client.path.get({ workspace }),
sdk.client.project.current({ workspace }),
])

if (seqnr < sync_seqnr) return

batch(() => {
setStore("instance", "path", reconcile(path.data!))
setStore("project", "id", project.data?.id)
Expand Down
Loading