Skip to content

Commit

Permalink
Bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Vlad Balin committed Sep 9, 2015
1 parent ecf2d31 commit 01363ef
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions react-nested.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* React-Backbone.Glue 0.1.0 <https://github.com/Volicon/react-backbone.glue>
* React-Backbone.Glue 0.1.1 <https://github.com/Volicon/react-backbone.glue>
* (c) 2015 Vlad Balin & Volicon
* Released under MIT @license
*/
Expand Down Expand Up @@ -172,12 +172,7 @@
// new element instance needs to be created on next render...
if( this.element ){
this.element = null;

if( this.component && this.component.trigger ){
this.stopListening( this.component );
}

this.component = null;
this.unmountComponent();
}

return Backbone.View.prototype.setElement.apply( this, arguments );
Expand All @@ -186,6 +181,17 @@
// cached instance of react component...
component : null,

unmountComponent : function(){
if( this.component ){
if( this.component.trigger ){
this.stopListening( this.component );
}

React.unmountComponentAtNode( this.el );
this.component = null;
}
},

render : function(){
if( !this.element ){
this.element = React.createElement.apply( React, this._args );
Expand All @@ -199,6 +205,11 @@
this.trigger.apply( this, arguments );
});
}
},

dispose : function(){
this.unmountComponent();
Backbone.View.prototype.dispose.apply( this, arguments );
}
});

Expand Down

0 comments on commit 01363ef

Please sign in to comment.