Delete all children of ItemType when it is deleted

This commit is contained in:
Kevin Jahns
2019-04-26 12:29:28 +02:00
parent 1d0f9faa91
commit 21d86cd2be
6 changed files with 44 additions and 25 deletions

View File

@@ -165,9 +165,9 @@ export const transact = (y, f) => {
// transaction cleanup
const store = transaction.y.store
const ds = transaction.deleteSet
// replace deleted items with ItemDeleted / GC
sortAndMergeDeleteSet(ds)
y.emit('afterTransaction', [transaction, y])
// replace deleted items with ItemDeleted / GC
for (const [client, deleteItems] of ds.clients) {
/**
* @type {Array<AbstractStruct>}

View File

@@ -270,8 +270,5 @@ export const createAbsolutePositionFromCursor = (cursor, y) => {
* @function
*/
export const compareCursors = (a, b) => a === b || (
a !== null && b !== null && a.tname === b.tname && (
(a.item !== null && b.item !== null && compareIDs(a.item, b.item)) ||
(a.type !== null && b.type !== null && compareIDs(a.type, b.type))
)
a !== null && b !== null && a.tname === b.tname && compareIDs(a.item, b.item) && compareIDs(a.type, b.type)
)