fixed part of split/merge logic

This commit is contained in:
Kevin Jahns
2019-04-08 13:41:28 +02:00
parent 7a111de186
commit e1a9f314a7
8 changed files with 39 additions and 29 deletions

View File

@@ -189,13 +189,11 @@ export const readDeleteSet = (decoder, transaction, store) => {
* @type {AbstractItem}
*/
// @ts-ignore
let struct = structs[index++]
if (!struct.deleted) {
if (struct.id.clock < clock) {
struct = struct.splitAt(store, clock - struct.id.clock)
structs.splice(index, 0, struct)
}
struct.delete(transaction)
let struct = structs[index]
// split the first item if necessary
if (!struct.deleted && struct.id.clock < clock) {
structs.splice(index + 1, 0, struct.splitAt(store, clock - struct.id.clock))
index++ // increase we now want to use the next struct
}
while (index < structs.length) {
// @ts-ignore