The open source coding agent.
TypeScript
fix(app): handle new session correctly
Adamda78b758d43c
diff --git a/packages/app/src/context/global-sync.tsx b/packages/app/src/context/global-sync.tsxindex 2df58eff2bf..74641a0a243 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) {