summaryrefslogtreecommitdiffhomepage
path: root/packages/app/src/context/global-sync
diff options
context:
space:
mode:
authorBrendan Allan <[email protected]>2026-04-21 14:11:23 +0800
committerGitHub <[email protected]>2026-04-21 14:11:23 +0800
commit22d33c57af94f3bac5022f64ec11c82a06c015c8 (patch)
tree136985b6b553185fd34bad3f2d64f194cb89e59f /packages/app/src/context/global-sync
parent1e0137f624e5b370ae5e1c21b4a512889e83928d (diff)
downloadopencode-22d33c57af94f3bac5022f64ec11c82a06c015c8.tar.gz
opencode-22d33c57af94f3bac5022f64ec11c82a06c015c8.zip
fix(app): properly wrap produce calls in setProjects (#23638)
Diffstat (limited to 'packages/app/src/context/global-sync')
-rw-r--r--packages/app/src/context/global-sync/event-reducer.ts18
1 files changed, 11 insertions, 7 deletions
diff --git a/packages/app/src/context/global-sync/event-reducer.ts b/packages/app/src/context/global-sync/event-reducer.ts
index 11a0cf83f..82408fdfe 100644
--- a/packages/app/src/context/global-sync/event-reducer.ts
+++ b/packages/app/src/context/global-sync/event-reducer.ts
@@ -21,7 +21,7 @@ const SKIP_PARTS = new Set(["patch", "step-start", "step-finish"])
export function applyGlobalEvent(input: {
event: { type: string; properties?: unknown }
project: Project[]
- setGlobalProject: (next: Project[] | ((draft: Project[]) => void)) => void
+ setGlobalProject: (next: Project[] | ((draft: Project[]) => Project[])) => void
refresh: () => void
}) {
if (input.event.type === "global.disposed" || input.event.type === "server.connected") {
@@ -33,14 +33,18 @@ export function applyGlobalEvent(input: {
const properties = input.event.properties as Project
const result = Binary.search(input.project, properties.id, (s) => s.id)
if (result.found) {
- input.setGlobalProject((draft) => {
- draft[result.index] = { ...draft[result.index], ...properties }
- })
+ input.setGlobalProject(
+ produce((draft) => {
+ draft[result.index] = { ...draft[result.index], ...properties }
+ }),
+ )
return
}
- input.setGlobalProject((draft) => {
- draft.splice(result.index, 0, properties)
- })
+ input.setGlobalProject(
+ produce((draft) => {
+ draft.splice(result.index, 0, properties)
+ }),
+ )
}
function cleanupSessionCaches(