Fix RightPanelStore handling first room on app launch wrong (#8370)

t3chguy/dedup-icons-17oct
Michael Telatynski 2022-04-20 11:05:55 +01:00 committed by GitHub
parent 859fdf7d51
commit 2f6b76755c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -34,6 +34,7 @@ import {
import { ActionPayload } from "../../dispatcher/payloads"; import { ActionPayload } from "../../dispatcher/payloads";
import { Action } from "../../dispatcher/actions"; import { Action } from "../../dispatcher/actions";
import { ActiveRoomChangedPayload } from "../../dispatcher/payloads/ActiveRoomChangedPayload"; import { ActiveRoomChangedPayload } from "../../dispatcher/payloads/ActiveRoomChangedPayload";
import { RoomViewStore } from "../RoomViewStore";
/** /**
* A class for tracking the state of the right panel between layouts and * A class for tracking the state of the right panel between layouts and
@ -55,6 +56,7 @@ export default class RightPanelStore extends ReadyWatchingStore {
} }
protected async onReady(): Promise<any> { protected async onReady(): Promise<any> {
this.viewedRoomId = RoomViewStore.instance.getRoomId();
this.matrixClient.on(CryptoEvent.VerificationRequest, this.onVerificationRequestUpdate); this.matrixClient.on(CryptoEvent.VerificationRequest, this.onVerificationRequestUpdate);
this.loadCacheFromSettings(); this.loadCacheFromSettings();
this.emitAndUpdateSettings(); this.emitAndUpdateSettings();
@ -348,6 +350,7 @@ export default class RightPanelStore extends ReadyWatchingStore {
}; };
private handleViewedRoomChange(oldRoomId: Optional<string>, newRoomId: Optional<string>) { private handleViewedRoomChange(oldRoomId: Optional<string>, newRoomId: Optional<string>) {
if (!this.mxClient) return; // not ready, onReady will handle the first room
this.viewedRoomId = newRoomId; this.viewedRoomId = newRoomId;
// load values from byRoomCache with the viewedRoomId. // load values from byRoomCache with the viewedRoomId.
this.loadCacheFromSettings(); this.loadCacheFromSettings();