diff options
| author | Adam <[email protected]> | 2026-01-16 14:49:04 -0600 |
|---|---|---|
| committer | Adam <[email protected]> | 2026-01-16 14:49:04 -0600 |
| commit | da78b758d43c3da4a670d6b6421572cf17d37fef (patch) | |
| tree | 4ef5698af68d0bae485d049501bb9fd87dc63101 /packages/app/src/context | |
| parent | 360765c5910f1391fd4712da5e0fa4044b15a307 (diff) | |
| download | opencode-da78b758d43c3da4a670d6b6421572cf17d37fef.tar.gz opencode-da78b758d43c3da4a670d6b6421572cf17d37fef.zip | |
fix(app): handle new session correctly
Diffstat (limited to 'packages/app/src/context')
| -rw-r--r-- | packages/app/src/context/global-sync.tsx | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/packages/app/src/context/global-sync.tsx b/packages/app/src/context/global-sync.tsx index 2df58eff2..74641a0a2 100644 --- a/packages/app/src/context/global-sync.tsx +++ b/packages/app/src/context/global-sync.tsx @@ -351,6 +351,23 @@ function createGlobalSync() { bootstrapInstance(directory) break } + case "session.created": { + const result = Binary.search(store.session, event.properties.info.id, (s) => s.id) + if (result.found) { + setStore("session", result.index, reconcile(event.properties.info)) + break + } + setStore( + "session", + produce((draft) => { + draft.splice(result.index, 0, event.properties.info) + }), + ) + if (!event.properties.info.parentID) { + setStore("sessionTotal", store.sessionTotal + 1) + } + break + } case "session.updated": { const result = Binary.search(store.session, event.properties.info.id, (s) => s.id) if (event.properties.info.time.archived) { |
