mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 19:45:05 +01:00
Avoid simply incrementing fragment ID to get next fragment
This commit is contained in:
parent
3ce2d0777d
commit
7f91e0c1bd
@ -25,11 +25,6 @@ export class EventKey {
|
|||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
nextFragmentKey(): EventKey {
|
|
||||||
// could take MIN_EVENT_INDEX here if it can't be paged back
|
|
||||||
return new EventKey(this.fragmentId + 1, KeyLimits.middleStorageKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
nextKeyForDirection(direction: Direction): EventKey {
|
nextKeyForDirection(direction: Direction): EventKey {
|
||||||
if (direction.isForward) {
|
if (direction.isForward) {
|
||||||
return this.nextKey();
|
return this.nextKey();
|
||||||
|
@ -124,7 +124,8 @@ export class SyncWriter {
|
|||||||
} else if (timeline.limited) {
|
} else if (timeline.limited) {
|
||||||
// replace live fragment for limited sync, *only* if we had a live fragment already
|
// replace live fragment for limited sync, *only* if we had a live fragment already
|
||||||
const oldFragmentId = currentKey.fragmentId;
|
const oldFragmentId = currentKey.fragmentId;
|
||||||
currentKey = currentKey.nextFragmentKey();
|
const maxFragmentId = await txn.timelineFragments.getMaxFragmentId(this._roomId);
|
||||||
|
currentKey = EventKey.defaultFragmentKey(maxFragmentId + 1);
|
||||||
const {oldFragment, newFragment} = await this._replaceLiveFragment(oldFragmentId, currentKey.fragmentId, timeline.prev_batch, txn);
|
const {oldFragment, newFragment} = await this._replaceLiveFragment(oldFragmentId, currentKey.fragmentId, timeline.prev_batch, txn);
|
||||||
entries.push(FragmentBoundaryEntry.end(oldFragment, this._fragmentIdComparer));
|
entries.push(FragmentBoundaryEntry.end(oldFragment, this._fragmentIdComparer));
|
||||||
entries.push(FragmentBoundaryEntry.start(newFragment, this._fragmentIdComparer));
|
entries.push(FragmentBoundaryEntry.start(newFragment, this._fragmentIdComparer));
|
||||||
|
Loading…
Reference in New Issue
Block a user