mirror of
https://github.com/yjs/yjs.git
synced 2025-12-16 11:47:46 +01:00
[iterateStructs] additional check for non-existent structs
This commit is contained in:
@@ -58,10 +58,12 @@ export class DeleteSet {
|
||||
export const iterateDeletedStructs = (transaction, ds, f) =>
|
||||
ds.clients.forEach((deletes, clientid) => {
|
||||
const structs = /** @type {Array<GC|Item>} */ (transaction.doc.store.clients.get(clientid))
|
||||
const lastStruct = structs[structs.length - 1]
|
||||
const clockState = lastStruct.id.clock + lastStruct.length
|
||||
for (let i = 0, del = deletes[i]; i < deletes.length && del.clock < clockState; del = deletes[++i]) {
|
||||
iterateStructs(transaction, structs, del.clock, del.len, f)
|
||||
if (structs != null) {
|
||||
const lastStruct = structs[structs.length - 1]
|
||||
const clockState = lastStruct.id.clock + lastStruct.length
|
||||
for (let i = 0, del = deletes[i]; i < deletes.length && del.clock < clockState; del = deletes[++i]) {
|
||||
iterateStructs(transaction, structs, del.clock, del.len, f)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user