jump to latest using empty timeline and back pagination to prevent live message lost

This commit is contained in:
Ajay Bura committed 2026-08-17 14:59:55 +05:30
1 parent 599e938353
commit bb013ef29e
3 files changed
+6 -18

No files matched your search

+1 -8
View File
@@ -288,15 +288,8 @@ export class ThreadTimeline implements TimelineView, Disposable {
this.range.setRange(MessageRange.atLiveEnd(this.batch.read.size));
return;
}
const [err, result] = await this.getMessages(undefined, 'b', 80);
if (err) {
throw new Error(printMatrixError(err));
}
const { next_batch: prevToken, prev_batch: endToken, chunk } = result;
const messageEvents: MessageEventWithoutRoomId[] = this.relations.pickAndFilter(chunk);
this.batchManager.loadEvents(messageEvents, prevToken, endToken);
this.batchManager.reload(MessageBatch.emptyAtForwardEnd());
}
public findEvent(eventId: string): MessageEventWithoutRoomId | undefined {
+1 -10
View File
@@ -281,17 +281,8 @@ export class Timeline implements TimelineView, Disposable {
this.range.setRange(MessageRange.atLiveEnd(this.batch.read.size));
return;
}
const [err, result] = await this.getMessages(undefined, 'b', 80);
if (err) {
throw new Error(printMatrixError(err));
}
const { end: prevToken, start: endToken, chunk } = result;
const messageEvents: MessageEventWithoutRoomId[] = this.relations.pickAndFilter(chunk);
this.pickThreads(messageEvents);
this.batchManager.loadEvents(messageEvents, prevToken, endToken);
this.batchManager.reload(MessageBatch.emptyAtForwardEnd());
}
public findEvent(eventId: string): MessageEventWithoutRoomId | undefined {
+4
View File
@@ -126,4 +126,8 @@ export class TimelineBatchManager {
this.batch.publish(this.publishKey, newBatch);
}
public reload(batch: MessageBatch) {
this.batch.publish(this.publishKey, batch);
}
}