Compare origin ids in item.integrate
This commit is contained in:
@@ -125,6 +125,16 @@ export const find = (store, id) => {
|
||||
return structs[findIndexSS(structs, id.clock)]
|
||||
}
|
||||
|
||||
/**
|
||||
* Expects that id is actually in store. This function throws or is an infinite loop otherwise.
|
||||
*
|
||||
* @param {StructStore} store
|
||||
* @param {ID} id
|
||||
* @return {AbstractItem}
|
||||
*/
|
||||
// @ts-ignore
|
||||
export const getItem = (store, id) => find(store, id)
|
||||
|
||||
/**
|
||||
* Expects that id is actually in store. This function throws or is an infinite loop otherwise.
|
||||
*
|
||||
|
||||
@@ -95,16 +95,16 @@ export class Y extends Observable {
|
||||
callEventHandlerListeners(type._dEH, [events, transaction])
|
||||
})
|
||||
// only call afterTransaction listeners if anything changed
|
||||
const transactionChangedContent = transaction.changedParentTypes.size !== 0
|
||||
const transactionChangedContent = transaction.changedParentTypes.size > 0 || transaction.deleteSet.clients.size > 0
|
||||
if (transactionChangedContent) {
|
||||
transaction.afterState = getStates(transaction.y.store)
|
||||
// when all changes & events are processed, emit afterTransaction event
|
||||
this.emit('afterTransaction', [this, transaction])
|
||||
// transaction cleanup
|
||||
const store = transaction.y.store
|
||||
const ds = transaction.deleteSet
|
||||
// replace deleted items with ItemDeleted / GC
|
||||
sortAndMergeDeleteSet(ds)
|
||||
this.emit('afterTransaction', [this, transaction])
|
||||
/**
|
||||
* @type {Set<ItemDeleted|GC>}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user