Skip to content

Commit

Permalink
Use Room.getLiveTimeline instead of deprecated this.currentState
Browse files Browse the repository at this point in the history
  • Loading branch information
andybalaam committed Jan 9, 2023
1 parent 1060335 commit 014d39e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/models/room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2974,7 +2974,12 @@ export class Room extends ReadReceipt<RoomEmittedEvents, RoomEventHandlerMap> {
* this room has no predecessor.
*/
public findPredecessorRoomId(): string | null {
const createEvent = this.currentState.getStateEvents(EventType.RoomCreate, "");
const currentState = this.getLiveTimeline().getState(EventTimeline.FORWARDS);
if (!currentState) {
return null;
}

const createEvent = currentState.getStateEvents(EventType.RoomCreate, "");
if (createEvent) {
const predecessor = createEvent.getContent()["predecessor"];
if (predecessor) {
Expand Down

0 comments on commit 014d39e

Please sign in to comment.