mirror of
https://github.com/sst/opencode.git
synced 2025-12-23 10:11:41 +00:00
Merge fc36599f79 into 83397ebde2
This commit is contained in:
commit
7ccafe8580
1 changed files with 18 additions and 0 deletions
|
|
@ -149,6 +149,17 @@ export const { use: useSync, provider: SyncProvider } = createSimpleContext({
|
|||
draft.splice(result.index, 1)
|
||||
}),
|
||||
)
|
||||
break
|
||||
}
|
||||
// Linear search fallback for sort order edge cases
|
||||
const linearIndex = store.session.findIndex((s) => s.id === event.properties.info.id)
|
||||
if (linearIndex !== -1) {
|
||||
setStore(
|
||||
"session",
|
||||
produce((draft) => {
|
||||
draft.splice(linearIndex, 1)
|
||||
}),
|
||||
)
|
||||
}
|
||||
break
|
||||
}
|
||||
|
|
@ -158,6 +169,13 @@ export const { use: useSync, provider: SyncProvider } = createSimpleContext({
|
|||
setStore("session", result.index, reconcile(event.properties.info))
|
||||
break
|
||||
}
|
||||
// Linear search fallback for sort order edge cases
|
||||
const linearIndex = store.session.findIndex((s) => s.id === event.properties.info.id)
|
||||
if (linearIndex !== -1) {
|
||||
setStore("session", linearIndex, reconcile(event.properties.info))
|
||||
break
|
||||
}
|
||||
// Not found, insert at binary search position
|
||||
setStore(
|
||||
"session",
|
||||
produce((draft) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue