Refresh the room list only if validation failed

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
pull/21833/head
Šimon Brandner 2021-07-09 10:44:20 +02:00
parent 84b00b5c38
commit 6dcf860181
No known key found for this signature in database
GPG Key ID: 9760693FDD98A790
1 changed files with 13 additions and 8 deletions

View File

@ -138,12 +138,17 @@ export default class RoomDirectory extends React.Component<IProps, IState> {
instanceId = lsInstanceId;
}
this.setState({
protocolsLoading: false,
instanceId,
roomServer,
});
this.refreshRoomList();
// Refresh the room list only if validation failed and we had to change these
if (this.state.instanceId !== instanceId || this.state.roomServer !== roomServer) {
this.setState({
protocolsLoading: false,
instanceId,
roomServer,
});
this.refreshRoomList();
return;
}
this.setState({ protocolsLoading: false });
}, (err) => {
console.warn(`error loading third party protocols: ${err}`);
this.setState({ protocolsLoading: false });
@ -177,8 +182,8 @@ export default class RoomDirectory extends React.Component<IProps, IState> {
publicRooms: [],
loading: true,
error: null,
instanceId: null,
roomServer: null,
instanceId: localStorage.getItem(LAST_INSTANCE_KEY),
roomServer: localStorage.getItem(LAST_SERVER_KEY),
filterString: this.props.initialText || "",
selectedCommunityId,
communityName: null,