This commit is contained in:
cedefrespo 2025-12-23 15:42:27 +08:00 committed by GitHub
commit 7ccafe8580
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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) => {