Commit af8ca570 authored by Robert Knight's avatar Robert Knight

Fix real-time updates from standalone pages

Fix a type error where annotation objects rather than IDs were passed to
the streamer configuration on standalone annotation pages.
parent cf67a91d
...@@ -58,18 +58,18 @@ function AnnotationViewerController ( ...@@ -58,18 +58,18 @@ function AnnotationViewerController (
this.ready = fetchThread(store, id).then(function (annots) { this.ready = fetchThread(store, id).then(function (annots) {
annotationMapper.loadAnnotations(annots); annotationMapper.loadAnnotations(annots);
var topLevelID = annots.filter(function (annot) { var topLevelAnnot = annots.filter(function (annot) {
return (annot.references || []).length === 0; return (annot.references || []).length === 0;
})[0]; })[0];
if (!topLevelID) { if (!topLevelAnnot) {
return; return;
} }
streamFilter streamFilter
.setMatchPolicyIncludeAny() .setMatchPolicyIncludeAny()
.addClause('/references', 'one_of', topLevelID, true) .addClause('/references', 'one_of', topLevelAnnot.id, true)
.addClause('/id', 'equals', topLevelID, true); .addClause('/id', 'equals', topLevelAnnot.id, true);
streamer.setConfig('filter', { filter: streamFilter.getFilter() }); streamer.setConfig('filter', { filter: streamFilter.getFilter() });
annots.forEach(function (annot) { annots.forEach(function (annot) {
......
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