Skip to content
Snippets Groups Projects
Commit 5b21104d authored by Kevin Jahns's avatar Kevin Jahns
Browse files

del is applied after ins (type is always called when ins already deleted)

parent ecc2aef0
No related branches found
No related tags found
No related merge requests found
......@@ -381,25 +381,26 @@ module.exports = function (Y /* :any */) {
}
}
// Delete if DS says this is actually deleted
var opIsDeleted = yield* transaction.isDeleted(op.id)
if (!op.deleted && opIsDeleted) {
var delop = {
struct: 'Delete',
target: op.id
}
yield* Y.Struct['Delete'].execute.call(transaction, delop)
}
// notify parent, if it was instanciated as a custom type
if (t != null) {
let o = Y.utils.copyObject(op)
if (opIsDeleted && !o.deleted) {
// op did not reflect the created delete op (happens when not using y-memory)
o.deleted = true
}
yield* t._changed(transaction, o)
}
// Delete if DS says this is actually deleted
var len = op.content != null ? op.content.length : 1
for (var i = 0; i < len; i++) {
var id = [op.id[0], op.id[1] + i]
if (!op.deleted) {
var opIsDeleted = yield* transaction.isDeleted(id)
if (opIsDeleted) {
var delop = {
struct: 'Delete',
target: id
}
yield* this.tryExecute.call(transaction, delop)
}
}
}
}
}
whenTransactionsFinished () {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment