summaryrefslogtreecommitdiffhomepage
path: root/packages/app/src/context/global-sync
diff options
context:
space:
mode:
authorShoubhit Dash <[email protected]>2026-03-25 21:09:53 +0530
committerGitHub <[email protected]>2026-03-25 21:09:53 +0530
commit73e107250dd44afef244021694a3343d2cc9715a (patch)
tree2b8fb6b810a1bc12fe06d1663dcdae1409670ba8 /packages/app/src/context/global-sync
parentb746aec49316d8f83d40aa34fa55bf7cff81c036 (diff)
downloadopencode-73e107250dd44afef244021694a3343d2cc9715a.tar.gz
opencode-73e107250dd44afef244021694a3343d2cc9715a.zip
feat: restore git-backed review modes with effectful git service (#18900)
Diffstat (limited to 'packages/app/src/context/global-sync')
-rw-r--r--packages/app/src/context/global-sync/bootstrap.ts2
-rw-r--r--packages/app/src/context/global-sync/event-reducer.test.ts10
-rw-r--r--packages/app/src/context/global-sync/event-reducer.ts4
3 files changed, 9 insertions, 7 deletions
diff --git a/packages/app/src/context/global-sync/bootstrap.ts b/packages/app/src/context/global-sync/bootstrap.ts
index 47be3abcb..9158fb46e 100644
--- a/packages/app/src/context/global-sync/bootstrap.ts
+++ b/packages/app/src/context/global-sync/bootstrap.ts
@@ -190,7 +190,7 @@ export async function bootstrapDirectory(input: {
input.sdk.vcs.get().then((x) => {
const next = x.data ?? input.store.vcs
input.setStore("vcs", next)
- if (next?.branch) input.vcsCache.setStore("value", next)
+ if (next) input.vcsCache.setStore("value", next)
}),
),
() => retry(() => input.sdk.command.list().then((x) => input.setStore("command", x.data ?? []))),
diff --git a/packages/app/src/context/global-sync/event-reducer.test.ts b/packages/app/src/context/global-sync/event-reducer.test.ts
index cf2da135c..892129788 100644
--- a/packages/app/src/context/global-sync/event-reducer.test.ts
+++ b/packages/app/src/context/global-sync/event-reducer.test.ts
@@ -494,8 +494,10 @@ describe("applyDirectoryEvent", () => {
})
test("updates vcs branch in store and cache", () => {
- const [store, setStore] = createStore(baseState())
- const [cacheStore, setCacheStore] = createStore({ value: undefined as State["vcs"] })
+ const [store, setStore] = createStore(baseState({ vcs: { branch: "main", default_branch: "main" } }))
+ const [cacheStore, setCacheStore] = createStore({
+ value: { branch: "main", default_branch: "main" } as State["vcs"],
+ })
applyDirectoryEvent({
event: { type: "vcs.branch.updated", properties: { branch: "feature/test" } },
@@ -511,8 +513,8 @@ describe("applyDirectoryEvent", () => {
},
})
- expect(store.vcs).toEqual({ branch: "feature/test" })
- expect(cacheStore.value).toEqual({ branch: "feature/test" })
+ expect(store.vcs).toEqual({ branch: "feature/test", default_branch: "main" })
+ expect(cacheStore.value).toEqual({ branch: "feature/test", default_branch: "main" })
})
test("routes disposal and lsp events to side-effect handlers", () => {
diff --git a/packages/app/src/context/global-sync/event-reducer.ts b/packages/app/src/context/global-sync/event-reducer.ts
index 5d8b7c4e3..4af636553 100644
--- a/packages/app/src/context/global-sync/event-reducer.ts
+++ b/packages/app/src/context/global-sync/event-reducer.ts
@@ -271,9 +271,9 @@ export function applyDirectoryEvent(input: {
break
}
case "vcs.branch.updated": {
- const props = event.properties as { branch: string }
+ const props = event.properties as { branch?: string }
if (input.store.vcs?.branch === props.branch) break
- const next = { branch: props.branch }
+ const next = { ...input.store.vcs, branch: props.branch }
input.setStore("vcs", next)
if (input.vcsCache) input.vcsCache.setStore("value", next)
break