Skip to content

Commit

Permalink
emptyRegion fixes
Browse files Browse the repository at this point in the history
Until marionettejs#3247 is in, the `_parent` here will skip over the `CollectionView` and trigger on any `View` above the `CollectionView`.  For that reason, currently setting the `_parent` here is a bad idea and users will have to listen to the `emptyRegion` or `emptyRegion.currentView`.  Until a CollectionView can be treated as a parent of a Region we should leave this line out 😿

Additionally the emptyRegion should be destroyed on clean up
  • Loading branch information
paulfalgout committed Apr 30, 2017
1 parent 7300ce0 commit 84d0eee
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/next-collection-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@ const CollectionView = Backbone.View.extend({

// Create an region to show the emptyView
_initEmptyRegion() {
this.emptyRegion = new Region({ el: this.el })

this.emptyRegion._parent = this;
this.emptyRegion = new Region({ el: this.el });
},

// Configured the initial events that the collection view binds to.
Expand Down Expand Up @@ -660,6 +658,7 @@ const CollectionView = Backbone.View.extend({
// called by ViewMixin destroy
_removeChildren() {
this._destroyChildren();
this.emptyRegion.destroy();
},

// Destroy the child views that this collection view is holding on to, if any
Expand Down

0 comments on commit 84d0eee

Please sign in to comment.