Commit 6ee5b8da authored by Randall Leeds's avatar Randall Leeds

Merge pull request #808 from hypothesis/807-fix-bridge-dataflow

Bridge: don't skip old data in the 'loadAnnotations' notifications
parents 9316e1a0 9fd9abe4
...@@ -145,6 +145,9 @@ class Annotator.Plugin.Bridge extends Annotator.Plugin ...@@ -145,6 +145,9 @@ class Annotator.Plugin.Bridge extends Annotator.Plugin
## Notifications ## Notifications
.bind('loadAnnotations', (txn, annotations) => .bind('loadAnnotations', (txn, annotations) =>
# First, parse the existing ones, for any updates
this._parse a for a in annotations when @cache[a.tag]
# Then collect the new ones
annotations = (this._parse a for a in annotations when not @cache[a.tag]) annotations = (this._parse a for a in annotations when not @cache[a.tag])
@annotator.loadAnnotations annotations @annotator.loadAnnotations annotations
) )
...@@ -268,7 +271,7 @@ class Annotator.Plugin.Bridge extends Annotator.Plugin ...@@ -268,7 +271,7 @@ class Annotator.Plugin.Bridge extends Annotator.Plugin
annotationsLoaded: (annotations) => annotationsLoaded: (annotations) =>
this._notify this._notify
method: 'loadAnnotations' method: 'loadAnnotations'
params: (this._format a for a in annotations when not a.$$tag?) params: (this._format a for a in annotations)
this this
beforeCreateAnnotation: (annotation, cb) -> beforeCreateAnnotation: (annotation, cb) ->
......
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