Skip to content
This repository has been archived by the owner on May 11, 2021. It is now read-only.

Commit

Permalink
Remove query from public list when it's destroyed
Browse files Browse the repository at this point in the history
Signed-off-by: Don Naegely <[email protected]>
  • Loading branch information
naegelyd committed Oct 7, 2014
1 parent 388db8f commit fc7762f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/js/cilantro/ui/query/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ define([
sync: 'onCollectionSync',
error: 'onCollectionError',
request: 'onCollectionRequest',
destroy: 'onCollectionDestroy'
destroy: '_refreshList',
remove: '_refreshList'
},

itemViewOptions: function(model, index) {
Expand Down Expand Up @@ -74,15 +75,6 @@ define([
this.checkForEmptyCollection();
},

// When a model is destroyed, it does not call sync on the collection
// but it does trigger a destroy event on the collection. That is the
// reason for this separate handler. When a query is deleted, we will
// get the request event and then destroy event, there will never be
// a sync event in the case a user deleting a query.
onCollectionDestroy: function() {
this._refreshList();
},

onCollectionError: function() {
this.$('.empty-message').hide();
this.$('.error-message').show();
Expand Down
3 changes: 3 additions & 0 deletions src/js/cilantro/ui/workflows/workspace.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ define([
this.data.publicQueries.fetch({reset: true});
});

this.listenTo(this.data.queries, 'destroy', function(model) {
this.data.publicQueries.remove(model);
});
}

this.listenTo(c.data.concepts, 'reset', function() {
Expand Down

0 comments on commit fc7762f

Please sign in to comment.