Commit a0bdcbab authored by Robert Knight's avatar Robert Knight

Fix annotation state not being updated when annotations are saved

Annotations in the app's local state store were not being updated
after a save was successfully committed on the server.

Fixes hypothesis/h#2965
parent 8629fd35
...@@ -89,6 +89,7 @@ function RootThread($rootScope, annotationUI, features, searchFilter, viewFilter ...@@ -89,6 +89,7 @@ function RootThread($rootScope, annotationUI, features, searchFilter, viewFilter
// the Redux store in annotationUI. // the Redux store in annotationUI.
var loadEvents = [events.BEFORE_ANNOTATION_CREATED, var loadEvents = [events.BEFORE_ANNOTATION_CREATED,
events.ANNOTATION_CREATED, events.ANNOTATION_CREATED,
events.ANNOTATION_UPDATED,
events.ANNOTATIONS_LOADED]; events.ANNOTATIONS_LOADED];
loadEvents.forEach(function (event) { loadEvents.forEach(function (event) {
$rootScope.$on(event, function (event, annotation) { $rootScope.$on(event, function (event, annotation) {
......
...@@ -255,6 +255,7 @@ describe('rootThread', function () { ...@@ -255,6 +255,7 @@ describe('rootThread', function () {
}, [ }, [
{event: events.BEFORE_ANNOTATION_CREATED, annotations: annot}, {event: events.BEFORE_ANNOTATION_CREATED, annotations: annot},
{event: events.ANNOTATION_CREATED, annotations: annot}, {event: events.ANNOTATION_CREATED, annotations: annot},
{event: events.ANNOTATION_UPDATED, annotations: annot},
{event: events.ANNOTATIONS_LOADED, annotations: [annot]}, {event: events.ANNOTATIONS_LOADED, annotations: [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