You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-09-01 21:21:58 +03:00
Fix pagination - set prev_batch at the right time
This commit is contained in:
11
lib/sync.js
11
lib/sync.js
@@ -301,9 +301,16 @@ SyncApi.prototype._sync = function(syncOptions, attempt) {
|
||||
// nuke the timeline so we don't get holes
|
||||
room.timeline = [];
|
||||
}
|
||||
|
||||
// we want to set a new pagination token if this is the first time
|
||||
// we've made this room or if we're nuking the timeline
|
||||
var paginationToken = null;
|
||||
if (joinObj.isBrandNewRoom || joinObj.timeline.limited) {
|
||||
paginationToken = joinObj.timeline.prev_batch;
|
||||
}
|
||||
|
||||
self._processRoomEvents(
|
||||
room, stateEvents, timelineEvents,
|
||||
joinObj.timeline ? joinObj.timeline.prev_batch : null
|
||||
room, stateEvents, timelineEvents, paginationToken
|
||||
);
|
||||
room.addEvents(ephemeralEvents);
|
||||
room.addEvents(accountDataEvents);
|
||||
|
Reference in New Issue
Block a user