Commit 8cce3de0 authored by csillag's avatar csillag

Temporary work-around: don't loose target while creating an annotation.

See #1020 for a description of the problem.

This commit patches the merge behavior of the bridge plugin:
never update a list of targets with a shorter list.
(This avoids it being zeroed by accident.)

This does not really solve the more generic problem: the race condition
of the messages moving on the bridge. We should either do some
time-stamping, or some other smarter flow control...
parent 6f8b0d19
......@@ -40,7 +40,10 @@ class Annotator.Plugin.Bridge extends Annotator.Plugin
# keys of the remote object into the local copy
merge: (local, remote) ->
for k, v of remote
local[k] = v
if k is "target" and local[k] and local[k].length > v.length
# console.log "Ignoring update which would make me loose a target."
else
local[k] = v
local
# Cache of annotations which have crossed the bridge for fast, encapsulated
......@@ -109,6 +112,7 @@ class Annotator.Plugin.Bridge extends Annotator.Plugin
options.origin = '*'
console.log "Bridge plugin connecting to #{options.origin}"
# options.debugOutput = true
channel = Channel.build(options)
## Remote method call bindings
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment