Fix timeline position when moving to a room and coming back (#12055)
* Force `initialEventId` in `RoomView` * Remove Force `initialEventId` in `RoomView` * Add e2e tests to verify we memorize the timeline position * Fill `viewRoomOpts` in `viewRoom` * Reset jest mock in sliding sync test * Add comments
This commit is contained in:
parent
537b4a1971
commit
3acd648ed3
6 changed files with 52 additions and 34 deletions
|
@ -1407,8 +1407,6 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
|
|||
tombstone: this.getRoomTombstone(room),
|
||||
liveTimeline: room.getLiveTimeline(),
|
||||
});
|
||||
|
||||
dis.dispatch<ActionPayload>({ action: Action.RoomLoaded });
|
||||
};
|
||||
|
||||
private onRoomTimelineReset = (room?: Room): void => {
|
||||
|
|
|
@ -372,11 +372,6 @@ export enum Action {
|
|||
*/
|
||||
OpenSpotlight = "open_spotlight",
|
||||
|
||||
/**
|
||||
* Fired when the room loaded.
|
||||
*/
|
||||
RoomLoaded = "room_loaded",
|
||||
|
||||
/**
|
||||
* Opens right panel with 3pid invite information
|
||||
*/
|
||||
|
|
|
@ -375,10 +375,6 @@ export class RoomViewStore extends EventEmitter {
|
|||
this.cancelAskToJoin(payload as CancelAskToJoinPayload);
|
||||
break;
|
||||
}
|
||||
case Action.RoomLoaded: {
|
||||
this.setViewRoomOpts();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -443,6 +439,10 @@ export class RoomViewStore extends EventEmitter {
|
|||
return;
|
||||
}
|
||||
|
||||
const viewRoomOpts: ViewRoomOpts = { buttons: [] };
|
||||
// Allow modules to update the list of buttons for the room by updating `viewRoomOpts`.
|
||||
ModuleRunner.instance.invoke(RoomViewLifecycle.ViewRoom, viewRoomOpts, this.getRoomId());
|
||||
|
||||
const newState: Partial<State> = {
|
||||
roomId: payload.room_id,
|
||||
roomAlias: payload.room_alias ?? null,
|
||||
|
@ -464,6 +464,7 @@ export class RoomViewStore extends EventEmitter {
|
|||
(payload.room_id === this.state.roomId
|
||||
? this.state.viewingCall
|
||||
: CallStore.instance.getActiveCall(payload.room_id) !== null),
|
||||
viewRoomOpts,
|
||||
};
|
||||
|
||||
// Allow being given an event to be replied to when switching rooms but sanity check its for this room
|
||||
|
@ -823,15 +824,4 @@ export class RoomViewStore extends EventEmitter {
|
|||
public getViewRoomOpts(): ViewRoomOpts {
|
||||
return this.state.viewRoomOpts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes the view room lifecycle to set the view room options.
|
||||
*
|
||||
* @returns {void}
|
||||
*/
|
||||
private setViewRoomOpts(): void {
|
||||
const viewRoomOpts: ViewRoomOpts = { buttons: [] };
|
||||
ModuleRunner.instance.invoke(RoomViewLifecycle.ViewRoom, viewRoomOpts, this.getRoomId());
|
||||
this.setState({ viewRoomOpts });
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue