diff options
| author | Brendan Allan <[email protected]> | 2026-04-21 14:11:23 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-04-21 14:11:23 +0800 |
| commit | 22d33c57af94f3bac5022f64ec11c82a06c015c8 (patch) | |
| tree | 136985b6b553185fd34bad3f2d64f194cb89e59f /packages/app/src/context/global-sync | |
| parent | 1e0137f624e5b370ae5e1c21b4a512889e83928d (diff) | |
| download | opencode-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.ts | 18 |
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( |
