Skip to content

Commit

Permalink
Pass room to getRoomTombstone to avoid racing with setState (#7986)
Browse files Browse the repository at this point in the history
  • Loading branch information
t3chguy committed Mar 4, 2022
1 parent 6174b13 commit aa48cfd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/structures/RoomView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1028,13 +1028,13 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
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) {
Expand Down

0 comments on commit aa48cfd

Please sign in to comment.