Defer updates of remote ops until Ace has been updated

This commit is contained in:
James Allen 2017-02-23 11:34:58 +01:00
parent f4bbd8ea10
commit 7418d12bf8

View file

@ -353,7 +353,12 @@ define [
@ranges.applyOp op, { user_id: track_changes_as }
if old_id_seed?
@ranges.setIdSeed(old_id_seed)
@emit "ranges:dirty"
if remote_op
# With remote ops, Ace hasn't been updated when we receive this op,
# so defer updating track changes until it has
setTimeout () => @emit "ranges:dirty"
else
@emit "ranges:dirty"
_catchUpRanges: (changes = [], comments = []) ->
# We've just been given the current server's ranges, but need to apply any local ops we have.