fixed some cases that lead to inconsistencies

This commit is contained in:
Kevin Jahns
2016-04-20 12:03:06 +02:00
parent 82025c5de9
commit f46c8df605
2 changed files with 19 additions and 8 deletions

View File

@@ -342,10 +342,24 @@ module.exports = function (Y /* :any */) {
this.store.addToDebug('yield* this.store.tryExecute.call(this, ', JSON.stringify(op), ')')
if (op.struct === 'Delete') {
yield* Y.Struct.Delete.execute.call(this, op)
// the following is now called in Transaction.deleteOperation!
// this is now called in Transaction.deleteOperation!
// yield* this.store.operationAdded(this, op)
} else {
// check if this op was defined
var defined = yield* this.getOperation(op.id)
while (defined != null && defined.content != null) {
// check if this op has a longer content in the case it is defined
if (defined.content.length < op.content.length) {
var diff = op.content.length - defined.content.length
op.content.splice(0, diff)
op.id = [op.id[0], op.id[1] + diff]
op.left = defined.id
op.origin = defined.id
defined = yield* this.getOperation(op.id)
} else {
break
}
}
if (defined == null) {
var isGarbageCollected = yield* this.isGarbageCollected(op.id)
if (!isGarbageCollected) {