mirror of
https://github.com/yjs/yjs.git
synced 2025-12-16 19:57:45 +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) =>
|
export const iterateDeletedStructs = (transaction, ds, f) =>
|
||||||
ds.clients.forEach((deletes, clientid) => {
|
ds.clients.forEach((deletes, clientid) => {
|
||||||
const structs = /** @type {Array<GC|Item>} */ (transaction.doc.store.clients.get(clientid))
|
const structs = /** @type {Array<GC|Item>} */ (transaction.doc.store.clients.get(clientid))
|
||||||
const lastStruct = structs[structs.length - 1]
|
if (structs != null) {
|
||||||
const clockState = lastStruct.id.clock + lastStruct.length
|
const lastStruct = structs[structs.length - 1]
|
||||||
for (let i = 0, del = deletes[i]; i < deletes.length && del.clock < clockState; del = deletes[++i]) {
|
const clockState = lastStruct.id.clock + lastStruct.length
|
||||||
iterateStructs(transaction, structs, del.clock, del.len, f)
|
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