@@ -50,6 +50,8 @@ module.exports = React.createClass({
50
50
} ,
51
51
52
52
componentWillMount : function ( ) {
53
+ this . mounted = false ;
54
+
53
55
var cli = MatrixClientPeg . get ( ) ;
54
56
cli . on ( "Room" , this . onRoom ) ;
55
57
cli . on ( "deleteRoom" , this . onDeleteRoom ) ;
@@ -69,9 +71,12 @@ module.exports = React.createClass({
69
71
this . dispatcherRef = dis . register ( this . onAction ) ;
70
72
// Initialise the stickyHeaders when the component is created
71
73
this . _updateStickyHeaders ( true ) ;
74
+
75
+ this . mounted = true ;
72
76
} ,
73
77
74
- componentDidUpdate : function ( ) {
78
+ componentDidUpdate : function ( prevp , nextp ) {
79
+ console . log ( prevp , nextp ) ;
75
80
// Reinitialise the stickyHeaders when the component is updated
76
81
this . _updateStickyHeaders ( true ) ;
77
82
this . _repositionIncomingCallBox ( undefined , false ) ;
@@ -106,6 +111,8 @@ module.exports = React.createClass({
106
111
} ,
107
112
108
113
componentWillUnmount : function ( ) {
114
+ this . mounted = false ;
115
+
109
116
dis . unregister ( this . dispatcherRef ) ;
110
117
if ( MatrixClientPeg . get ( ) ) {
111
118
MatrixClientPeg . get ( ) . removeListener ( "Room" , this . onRoom ) ;
@@ -311,6 +318,7 @@ module.exports = React.createClass({
311
318
} ,
312
319
313
320
_getScrollNode : function ( ) {
321
+ if ( ! this . mounted ) return null ;
314
322
var panel = ReactDOM . findDOMNode ( this ) ;
315
323
if ( ! panel ) return null ;
316
324
@@ -337,6 +345,7 @@ module.exports = React.createClass({
337
345
var incomingCallBox = document . getElementById ( "incomingCallBox" ) ;
338
346
if ( incomingCallBox && incomingCallBox . parentElement ) {
339
347
var scrollArea = this . _getScrollNode ( ) ;
348
+ if ( ! scrollArea ) return ;
340
349
// Use the offset of the top of the scroll area from the window
341
350
// as this is used to calculate the CSS fixed top position for the stickies
342
351
var scrollAreaOffset = scrollArea . getBoundingClientRect ( ) . top + window . pageYOffset ;
@@ -360,6 +369,7 @@ module.exports = React.createClass({
360
369
// properly through React
361
370
_initAndPositionStickyHeaders : function ( initialise , scrollToPosition ) {
362
371
var scrollArea = this . _getScrollNode ( ) ;
372
+ if ( ! scrollArea ) return ;
363
373
// Use the offset of the top of the scroll area from the window
364
374
// as this is used to calculate the CSS fixed top position for the stickies
365
375
var scrollAreaOffset = scrollArea . getBoundingClientRect ( ) . top + window . pageYOffset ;
0 commit comments