Basically, doc.inflightCallbacks can be overwritten with doc.pendingCallbacks before the server responds to a previous set of operations and calls their callbacks in doc._onMessage.
Here's the flow:
doc.submitOp([op1, op2], cb1)
// -> calls doc.flush() sets inflightCallbacks
// key/mouse event creates another set of ops
doc.submitOp([op3, op4], cb2)
// -> calls doc.flush() again and overwrites inflightCallbacks and inflightOp
// Server responds
// -> does not call cb1; calls cb2
Maybe the solution is to concat the pending and inflight callbacks.
We're attaching watchdogs to each submitOp call, and we rely on this callback to turn the watchdog off (and the saving... -> saved message in the interface). But the watchdogs are firing more than they should for folks with spotty connections, and it seems they are firing when data is actually making it to the server.
Also, if this is happening, there might be issues from overwriting the doc.inflightOp. But I'm not sure of the implications.
Sorry I didn't see this at the time - I was moving house. Is this still happening? This code has since been rewritten for 0.7, but not merged into master yet. It should be fixed now, though we should add a test for it.
We havent had any issues since upgrading to 0.6. Closing.