Pass room to getRoomTombstone to avoid racing with setState (#7986)

pull/21833/head
Michael Telatynski 2022-03-04 17:12:20 +00:00 committed by GitHub
parent 6174b13142
commit aa48cfd0a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -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) {