Yjs throws "error" event in unexpected cases. fixes #72

This commit is contained in:
Kevin Jahns 2017-07-05 17:58:19 +02:00
parent 033d24eee7
commit ae91902de3

View File

@ -833,10 +833,10 @@ export default function extendTransaction (Y) {
yield * this.setOperation(op) yield * this.setOperation(op)
return op return op
} else { } else {
// won't be called. but just in case.. throw new Error(
console.error('Unexpected case. How can this happen?') 'Unexpected case. Operation cannot be generated correctly!' +
debugger // eslint-disable-line 'Incompatible Yjs version?'
return null )
} }
} }
} }
@ -1003,8 +1003,10 @@ export default function extendTransaction (Y) {
op = Y.Struct[op.struct].encode(o) op = Y.Struct[op.struct].encode(o)
op.right = newright op.right = newright
if (missingOrigins.length > 0) { if (missingOrigins.length > 0) {
debugger throw new Error(
console.log('This should not happen .. :( please report this') 'Reached inconsistent OS state.' +
'Operations are not correctly connected.'
)
} }
missingOrigins = [op] missingOrigins = [op]
} else { } else {
@ -1019,11 +1021,6 @@ export default function extendTransaction (Y) {
} }
}) })
} }
if (send.some(o => send.filter(p => Y.utils.compareIds(o.id, p.id)).length > 1)) {
console.warn('getOperations os contains duplicates')
console.warn(send.map(o => send.filter(p => Y.utils.compareIds(o.id, p.id)).length))
debugger
}
return send.reverse() return send.reverse()
} }
/* /*