File tree Expand file tree Collapse file tree 1 file changed +18
-7
lines changed
Expand file tree Collapse file tree 1 file changed +18
-7
lines changed Original file line number Diff line number Diff line change 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 */
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 ) ;
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 ) ;
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
You can’t perform that action at this time.
0 commit comments