unbreak stack overflow which fires on tests due to mocked timers
This commit is contained in:
parent
0ad1d8caf3
commit
e69ea68133
1 changed files with 8 additions and 2 deletions
|
@ -74,7 +74,11 @@ module.exports = React.createClass({
|
||||||
this.setState(s);
|
this.setState(s);
|
||||||
|
|
||||||
// order of the sublists
|
// order of the sublists
|
||||||
this.listOrder = [];
|
//this.listOrder = [];
|
||||||
|
|
||||||
|
// loop count to stop a stack overflow if the user keeps waggling the
|
||||||
|
// mouse for >30s in a row, or if running under mocha
|
||||||
|
this._delayedRefreshRoomListLoopCount = 0
|
||||||
},
|
},
|
||||||
|
|
||||||
componentDidMount: function() {
|
componentDidMount: function() {
|
||||||
|
@ -284,10 +288,12 @@ module.exports = React.createClass({
|
||||||
// if the mouse has been moving over the RoomList in the last 500ms
|
// if the mouse has been moving over the RoomList in the last 500ms
|
||||||
// then delay the refresh further to avoid bouncing around under the
|
// then delay the refresh further to avoid bouncing around under the
|
||||||
// cursor
|
// cursor
|
||||||
if (Date.now() - this._lastMouseOverTs > 500) {
|
if (Date.now() - this._lastMouseOverTs > 500 || this._delayedRefreshRoomListLoopCount > 60) {
|
||||||
this.refreshRoomList();
|
this.refreshRoomList();
|
||||||
|
this._delayedRefreshRoomListLoopCount = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
this._delayedRefreshRoomListLoopCount++;
|
||||||
this._delayedRefreshRoomList();
|
this._delayedRefreshRoomList();
|
||||||
}
|
}
|
||||||
}, 500),
|
}, 500),
|
||||||
|
|
Loading…
Reference in a new issue