From 3a428efb6081716cd81cd316a7dc55709cf132ca Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Fri, 18 Oct 2019 18:01:57 +0100 Subject: [PATCH] Abort scroll updates when already unmounted This checks whether we're unmounted before updating scroll state, as we use async functions and timeouts in this area. Fixes https://github.com/vector-im/riot-web/issues/11150 --- src/components/structures/ScrollPanel.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/components/structures/ScrollPanel.js b/src/components/structures/ScrollPanel.js index cb29305dd3..32efad1e05 100644 --- a/src/components/structures/ScrollPanel.js +++ b/src/components/structures/ScrollPanel.js @@ -677,6 +677,11 @@ module.exports = createReactClass({ debuglog("updateHeight getting straight to business, no scrolling going on."); } + // We might have unmounted since the timer finished, so abort if so. + if (this.unmounted) { + return; + } + const sn = this._getScrollNode(); const itemlist = this.refs.itemlist; const contentHeight = this._getMessagesHeight();