From aa48cfd0a08b83d842189399375e44aa934de850 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 4 Mar 2022 17:12:20 +0000 Subject: [PATCH] Pass room to getRoomTombstone to avoid racing with setState (#7986) --- src/components/structures/RoomView.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/structures/RoomView.tsx b/src/components/structures/RoomView.tsx index a2805690aa..d69a9d2054 100644 --- a/src/components/structures/RoomView.tsx +++ b/src/components/structures/RoomView.tsx @@ -1028,13 +1028,13 @@ export class RoomView extends React.Component { this.checkWidgets(room); this.setState({ - tombstone: this.getRoomTombstone(), + tombstone: this.getRoomTombstone(room), liveTimeline: room.getLiveTimeline(), }); }; - private getRoomTombstone() { - return this.state.room?.currentState.getStateEvents(EventType.RoomTombstone, ""); + private getRoomTombstone(room = this.state.room) { + return room?.currentState.getStateEvents(EventType.RoomTombstone, ""); } private async calculateRecommendedVersion(room: Room) {