delete child if parent is deleted
This commit is contained in:
@@ -39,15 +39,20 @@ export function deleteItemRange (y, user, clock, range) {
|
||||
*/
|
||||
export default class Delete {
|
||||
constructor () {
|
||||
this._targetID = null
|
||||
this._target = null
|
||||
this._length = null
|
||||
}
|
||||
_fromBinary (y, decoder) {
|
||||
// TODO: set target, and add it to missing if not found
|
||||
// There is an edge case in p2p networks!
|
||||
this._targetID = decoder.readID()
|
||||
const targetID = decoder.readID()
|
||||
this._targetID = targetID
|
||||
this._length = decoder.readVarUint()
|
||||
return []
|
||||
if (y.os.getItem(targetID) === null) {
|
||||
return [targetID]
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
}
|
||||
_toBinary (encoder) {
|
||||
encoder.writeUint8(getReference(this.constructor))
|
||||
|
||||
@@ -196,6 +196,9 @@ export default class Item {
|
||||
right._left = this
|
||||
}
|
||||
}
|
||||
if (parent._deleted) {
|
||||
this._delete(y, false)
|
||||
}
|
||||
y.os.put(this)
|
||||
transactionTypeChanged(y, parent, parentSub)
|
||||
if (this._id.user !== RootFakeUserID) {
|
||||
@@ -205,7 +208,6 @@ export default class Item {
|
||||
if (y.persistence !== null) {
|
||||
y.persistence.saveOperations(this)
|
||||
}
|
||||
y.ds.applyMissingDeletesOnStruct(this)
|
||||
}
|
||||
}
|
||||
_toBinary (encoder) {
|
||||
|
||||
Reference in New Issue
Block a user