Skip to content

Commit e666394

Browse files
authored
Merge pull request #506 from DigitalSlideArchive/less-refresh
Do not refresh annotations unless they apply to the current item
2 parents 0093e7f + a7c9665 commit e666394

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

histomicsui/web_client/panels/AnnotationSelector.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ var AnnotationSelector = Panel.extend({
5555
this.listenTo(this.collection, 'change:highlight', this._changeAnnotationHighlight);
5656
this.listenTo(eventStream, 'g:event.job_status', _.debounce(this._onJobUpdate, 500));
5757
this.listenTo(eventStream, 'g:eventStream.start', this._refreshAnnotations);
58-
this.listenTo(eventStream, 'g:event.large_image_annotation.create', this._refreshAnnotations);
59-
this.listenTo(eventStream, 'g:event.large_image_annotation.remove', this._refreshAnnotations);
58+
this.listenTo(eventStream, 'g:event.large_image_annotation.create', this._refreshAnnotationsCheck);
59+
this.listenTo(eventStream, 'g:event.large_image_annotation.remove', this._refreshAnnotationsCheck);
6060
this.listenTo(this.collection, 'h:revert:annotation', this._refreshAnnotations);
6161
this.listenTo(this.collection, 'change:annotation change:groups', this._saveAnnotation);
6262
this.listenTo(girderEvents, 'g:login', () => {
@@ -279,6 +279,16 @@ var AnnotationSelector = Panel.extend({
279279
}
280280
},
281281

282+
_refreshAnnotationsCheck(evt) {
283+
if (!evt.data || !evt.data.itemId) {
284+
return;
285+
}
286+
if (!this.parentItem || !this.parentItem.id || evt.data.itemId !== this.parentItem.id) {
287+
return;
288+
}
289+
this._refreshAnnotations();
290+
},
291+
282292
_refreshAnnotations() {
283293
if (this._norefresh) {
284294
delete this._norefresh;

0 commit comments

Comments
 (0)