You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-09-03 08:42:03 +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
|
// nuke the timeline so we don't get holes
|
||||||
room.timeline = [];
|
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(
|
self._processRoomEvents(
|
||||||
room, stateEvents, timelineEvents,
|
room, stateEvents, timelineEvents, paginationToken
|
||||||
joinObj.timeline ? joinObj.timeline.prev_batch : null
|
|
||||||
);
|
);
|
||||||
room.addEvents(ephemeralEvents);
|
room.addEvents(ephemeralEvents);
|
||||||
room.addEvents(accountDataEvents);
|
room.addEvents(accountDataEvents);
|
||||||
|
Reference in New Issue
Block a user