You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-09-17 14:02:16 +03:00
Set our own booleans instead of using isMounted
This commit is contained in:
src/components/structures
@@ -112,6 +112,14 @@ module.exports = React.createClass({
|
||||
this.checkFillState();
|
||||
},
|
||||
|
||||
componentWillUnmount: function() {
|
||||
// set a boolean to say we've been unmounted, which any pending
|
||||
// promises can use to throw away their results.
|
||||
//
|
||||
// (We could use isMounted(), but facebook have deprecated that.)
|
||||
this.unmounted = true;
|
||||
},
|
||||
|
||||
onScroll: function(ev) {
|
||||
var sn = this._getScrollNode();
|
||||
debuglog("Scroll event: offset now:", sn.scrollTop, "recentEventScroll:", this.recentEventScroll);
|
||||
@@ -158,7 +166,7 @@ module.exports = React.createClass({
|
||||
|
||||
// check the scroll state and send out backfill requests if necessary.
|
||||
checkFillState: function() {
|
||||
if (!this.isMounted()) {
|
||||
if (this.unmounted) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -350,7 +358,7 @@ module.exports = React.createClass({
|
||||
* message panel.
|
||||
*/
|
||||
_getScrollNode: function() {
|
||||
if (!this.isMounted()) {
|
||||
if (this.unmounted) {
|
||||
// this shouldn't happen, but when it does, turn the NPE into
|
||||
// something more meaningful.
|
||||
throw new Error("ScrollPanel._getScrollNode called when unmounted");
|
||||
|
Reference in New Issue
Block a user