Skip to content

Commit 95b4f59

Browse files
author
Vlad Balin
committed
Bug fixes and version bump.
1 parent 01363ef commit 95b4f59

File tree

6 files changed

+41
-19
lines changed

6 files changed

+41
-19
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
],
3434

3535
"license": "MIT",
36-
"version": "0.1.0",
36+
"version": "0.1.1",
3737

3838
"scripts": {
3939
"make:backbone:win" : "type .\\umd\\copyright.js .\\umd\\backbone-head.js .\\src\\glue.js .\\umd\\tail.js > .\\react-backbone.js",

react-backbone.js

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* React-Backbone.Glue 0.1.0 <https://github.com/Volicon/react-backbone.glue>
2+
* React-Backbone.Glue 0.1.1 <https://github.com/Volicon/react-backbone.glue>
33
* (c) 2015 Vlad Balin & Volicon
44
* Released under MIT @license
55
*/
@@ -172,12 +172,7 @@
172172
// new element instance needs to be created on next render...
173173
if( this.element ){
174174
this.element = null;
175-
176-
if( this.component && this.component.trigger ){
177-
this.stopListening( this.component );
178-
}
179-
180-
this.component = null;
175+
this.unmountComponent();
181176
}
182177

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

184+
unmountComponent : function(){
185+
if( this.component ){
186+
if( this.component.trigger ){
187+
this.stopListening( this.component );
188+
}
189+
190+
React.unmountComponentAtNode( this.el );
191+
this.component = null;
192+
}
193+
},
194+
189195
render : function(){
190196
if( !this.element ){
191197
this.element = React.createElement.apply( React, this._args );
@@ -199,6 +205,11 @@
199205
this.trigger.apply( this, arguments );
200206
});
201207
}
208+
},
209+
210+
dispose : function(){
211+
this.unmountComponent();
212+
Backbone.View.prototype.dispose.apply( this, arguments );
202213
}
203214
});
204215

react-backbone.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

react-nested.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/glue.js

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,7 @@ function reactBackboneGlue( Backbone, React ){
157157
// new element instance needs to be created on next render...
158158
if( this.element ){
159159
this.element = null;
160-
161-
if( this.component && this.component.trigger ){
162-
this.stopListening( this.component );
163-
}
164-
165-
this.component = null;
160+
this.unmountComponent();
166161
}
167162

168163
return Backbone.View.prototype.setElement.apply( this, arguments );
@@ -171,6 +166,17 @@ function reactBackboneGlue( Backbone, React ){
171166
// cached instance of react component...
172167
component : null,
173168

169+
unmountComponent : function(){
170+
if( this.component ){
171+
if( this.component.trigger ){
172+
this.stopListening( this.component );
173+
}
174+
175+
React.unmountComponentAtNode( this.el );
176+
this.component = null;
177+
}
178+
},
179+
174180
render : function(){
175181
if( !this.element ){
176182
this.element = React.createElement.apply( React, this._args );
@@ -184,6 +190,11 @@ function reactBackboneGlue( Backbone, React ){
184190
this.trigger.apply( this, arguments );
185191
});
186192
}
193+
},
194+
195+
dispose : function(){
196+
this.unmountComponent();
197+
Backbone.View.prototype.dispose.apply( this, arguments );
187198
}
188199
});
189200

umd/copyright.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* React-Backbone.Glue 0.1.0 <https://github.com/Volicon/react-backbone.glue>
2+
* React-Backbone.Glue 0.1.1 <https://github.com/Volicon/react-backbone.glue>
33
* (c) 2015 Vlad Balin & Volicon
44
* Released under MIT @license
55
*/

0 commit comments

Comments
 (0)