mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
store last pagination token
This commit is contained in:
parent
d08297d1e0
commit
f84c9d51b4
@ -99,7 +99,7 @@ export class Room extends EventEmitter {
|
||||
} else {
|
||||
let members;
|
||||
if (!this._summary.hasFetchedMembers) {
|
||||
const paginationToken = throw new Error("not implemented");
|
||||
const paginationToken = this._summary.lastPaginationToken;
|
||||
// TODO: move all of this out of Room
|
||||
|
||||
// if any members are changed by sync while we're fetching members,
|
||||
|
@ -27,7 +27,12 @@ function applySyncResponse(data, roomResponse, membership) {
|
||||
data = roomResponse.state.events.reduce(processEvent, data);
|
||||
}
|
||||
if (roomResponse.timeline) {
|
||||
data = roomResponse.timeline.events.reduce(processEvent, data);
|
||||
const {timeline} = roomResponse;
|
||||
if (timeline.prev_batch) {
|
||||
data = data.cloneIfNeeded();
|
||||
data.lastPaginationToken = timeline.prev_batch;
|
||||
}
|
||||
data = timeline.events.reduce(processEvent, data);
|
||||
}
|
||||
|
||||
return data;
|
||||
@ -99,6 +104,7 @@ class SummaryData {
|
||||
this.canonicalAlias = copy ? copy.canonicalAlias : null;
|
||||
this.altAliases = copy ? copy.altAliases : null;
|
||||
this.hasFetchedMembers = copy ? copy.hasFetchedMembers : false;
|
||||
this.lastPaginationToken = copy ? copy.lastPaginationToken : null;
|
||||
this.cloned = copy ? true : false;
|
||||
}
|
||||
|
||||
@ -153,6 +159,10 @@ export class RoomSummary {
|
||||
return this._data.hasFetchedMembers;
|
||||
}
|
||||
|
||||
get lastPaginationToken() {
|
||||
return this._data.lastPaginationToken;
|
||||
}
|
||||
|
||||
writeHasFetchedMembers(value, txn) {
|
||||
const data = new SummaryData(this._data);
|
||||
data.hasFetchedMembers = value;
|
||||
|
Loading…
Reference in New Issue
Block a user