You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-06-26 04:01:04 +03:00
Fix some races due to promises completing after we've switched rooms
Add a few isMounted() checks to promise handlers so that we don't end up throwing NPEs.
This commit is contained in:
@ -158,6 +158,10 @@ module.exports = React.createClass({
|
||||
|
||||
// check the scroll state and send out backfill requests if necessary.
|
||||
checkFillState: function() {
|
||||
if (!this.isMounted()) {
|
||||
return;
|
||||
}
|
||||
|
||||
var sn = this._getScrollNode();
|
||||
|
||||
// if there is less than a screenful of messages above or below the
|
||||
@ -346,6 +350,12 @@ module.exports = React.createClass({
|
||||
* message panel.
|
||||
*/
|
||||
_getScrollNode: function() {
|
||||
if (!this.isMounted()) {
|
||||
// this shouldn't happen, but when it does, turn the NPE into
|
||||
// something more meaningful.
|
||||
throw new Error("ScrollPanel._getScrollNode called when unmounted");
|
||||
}
|
||||
|
||||
var panel = ReactDOM.findDOMNode(this.refs.geminiPanel);
|
||||
|
||||
// If the gemini scrollbar is doing its thing, this will be a div within
|
||||
|
Reference in New Issue
Block a user