Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
check on roomId instead of room
Browse files Browse the repository at this point in the history
  • Loading branch information
toger5 committed Nov 22, 2021
1 parent 57e11d3 commit b2fc55d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/components/views/voip/CallPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ export default class CallPreview extends React.Component<IProps, IState> {
this.roomStoreToken = RoomViewStore.addListener(this.onRoomViewStoreUpdate);
this.dispatcherRef = dis.register(this.onAction);
MatrixClientPeg.get().on(CallEvent.RemoteHoldUnhold, this.onCallRemoteHold);
const room = MatrixClientPeg.get().getRoom(this.state.roomId);
if (room) {
if (this.state.roomId) {
const room = MatrixClientPeg.get().getRoom(this.state.roomId);
WidgetLayoutStore.instance.on(WidgetLayoutStore.emissionForRoom(room), this.updateCalls);
}
}
Expand All @@ -142,11 +142,11 @@ export default class CallPreview extends React.Component<IProps, IState> {
if (newRoomId === oldRoomId) return;
// The WidgetLayoutStore observer always tracks the currently viewed Room,
// so we don't end up with multiple observers and know what observer to remove on unmount
const newRoom = MatrixClientPeg.get().getRoom(newRoomId);
const oldRoom = MatrixClientPeg.get().getRoom(oldRoomId);
if (oldRoom) {
if (oldRoomId) {
const oldRoom = MatrixClientPeg.get().getRoom(oldRoomId);
WidgetLayoutStore.instance.off(WidgetLayoutStore.emissionForRoom(oldRoom), this.updateCalls);
}
const newRoom = MatrixClientPeg.get().getRoom(newRoomId);
WidgetLayoutStore.instance.on(WidgetLayoutStore.emissionForRoom(newRoom), this.updateCalls);

const [primaryCall, secondaryCalls] = getPrimarySecondaryCallsForPip(newRoomId);
Expand Down

0 comments on commit b2fc55d

Please sign in to comment.