From 53334de5a9f2fea64b42c0d0b9dbe6fb004ea08e Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Sun, 31 Jan 2021 16:09:11 +0000 Subject: [PATCH] Fix RoomView re-mounting breaking peeking Because as of React 16 order of unmount & re-mount is undefined this was causing the possibility of the unmount running after the willMount of the replacement RoomView, upsetting the state of the singleton inside the js-sdk. --- src/components/structures/RoomView.tsx | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/components/structures/RoomView.tsx b/src/components/structures/RoomView.tsx index 5ab403a75c..7b72b7f33f 100644 --- a/src/components/structures/RoomView.tsx +++ b/src/components/structures/RoomView.tsx @@ -267,12 +267,6 @@ export default class RoomView extends React.Component { this.layoutWatcherRef = SettingsStore.watchSetting("useIRCLayout", null, this.onLayoutChange); } - // TODO: [REACT-WARNING] Move into constructor - // eslint-disable-next-line camelcase - UNSAFE_componentWillMount() { - this.onRoomViewStoreUpdate(true); - } - private onWidgetStoreUpdate = () => { if (this.state.room) { this.checkWidgets(this.state.room); @@ -512,6 +506,8 @@ export default class RoomView extends React.Component { } componentDidMount() { + this.onRoomViewStoreUpdate(true); + const call = this.getCallForRoom(); const callState = call ? call.state : null; this.setState({