File tree 1 file changed +9
-1
lines changed
1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import { MatrixClient } from "../client";
18
18
import { IEncryptedFile , RelationType , UNSTABLE_MSC3089_BRANCH } from "../@types/event" ;
19
19
import { IContent , MatrixEvent } from "./event" ;
20
20
import { MSC3089TreeSpace } from "./MSC3089TreeSpace" ;
21
+ import { EventTimeline } from "./event-timeline" ;
21
22
import { FileType } from "../http-api" ;
22
23
23
24
/**
@@ -140,7 +141,14 @@ export class MSC3089Branch {
140
141
const room = this . client . getRoom ( this . roomId ) ;
141
142
if ( ! room ) throw new Error ( "Unknown room" ) ;
142
143
143
- const event = room . getUnfilteredTimelineSet ( ) . findEventById ( this . id ) ;
144
+ let event : MatrixEvent | undefined = room . getUnfilteredTimelineSet ( ) . findEventById ( this . id ) ;
145
+
146
+ // keep scrolling back if needed until we find the event or reach the start of the room:
147
+ while ( ! event && room . getLiveTimeline ( ) . getState ( EventTimeline . FORWARDS ) . paginationToken ) {
148
+ await this . client . scrollback ( room , 100 ) ;
149
+ event = room . getUnfilteredTimelineSet ( ) . findEventById ( this . id ) ;
150
+ }
151
+
144
152
if ( ! event ) throw new Error ( "Failed to find event" ) ;
145
153
146
154
// Sometimes the event isn't decrypted for us, so do that. We specifically set `emit: true`
You can’t perform that action at this time.
0 commit comments