@@ -20,7 +20,6 @@ import { Room } from 'matrix-js-sdk/src/models/room';
2020import { IEventRelation , MatrixEvent } from 'matrix-js-sdk/src/models/event' ;
2121import { TimelineWindow } from 'matrix-js-sdk/src/timeline-window' ;
2222import { Direction } from 'matrix-js-sdk/src/models/event-timeline' ;
23- import { IRelationsRequestOpts } from 'matrix-js-sdk/src/@types/requests' ;
2423import { logger } from 'matrix-js-sdk/src/logger' ;
2524import classNames from 'classnames' ;
2625
@@ -195,9 +194,7 @@ export default class ThreadView extends React.Component<IProps, IState> {
195194 thread,
196195 } , async ( ) => {
197196 thread . emit ( ThreadEvent . ViewThread ) ;
198- await thread . fetchInitialEvents ( ) ;
199- this . nextBatch = thread . liveTimeline . getPaginationToken ( Direction . Backward ) ;
200- this . timelinePanel . current ?. refreshTimeline ( ) ;
197+ this . timelinePanel . current ?. refreshTimeline ( this . props . initialEvent ?. getId ( ) ) ;
201198 } ) ;
202199 }
203200 } ;
@@ -242,35 +239,12 @@ export default class ThreadView extends React.Component<IProps, IState> {
242239 }
243240 } ;
244241
245- private nextBatch : string ;
246-
247242 private onPaginationRequest = async (
248243 timelineWindow : TimelineWindow | null ,
249244 direction = Direction . Backward ,
250245 limit = 20 ,
251246 ) : Promise < boolean > => {
252- if ( ! Thread . hasServerSideSupport ) {
253- timelineWindow . extend ( direction , limit ) ;
254- return true ;
255- }
256-
257- const opts : IRelationsRequestOpts = {
258- limit,
259- } ;
260-
261- if ( this . nextBatch ) {
262- opts . from = this . nextBatch ;
263- }
264-
265- const { nextBatch } = await this . state . thread . fetchEvents ( opts ) ;
266-
267- this . nextBatch = nextBatch ;
268-
269- // Advances the marker on the TimelineWindow to define the correct
270- // window of events to display on screen
271- timelineWindow . extend ( direction , limit ) ;
272-
273- return ! ! nextBatch ;
247+ return timelineWindow . paginate ( direction , limit ) ;
274248 } ;
275249
276250 private onFileDrop = ( dataTransfer : DataTransfer ) => {
0 commit comments