From 8ca0f61cadcf469264c05792b3d7d5dd8c252ee9 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Tue, 16 Jan 2024 04:01:13 +0100 Subject: Disable optimistic pagination to fetch events edited into the thread before the threadroot fixes #1661 --- src/timeline/TimelineFilter.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/timeline/TimelineFilter.cpp b/src/timeline/TimelineFilter.cpp index ae7e9791..a933a9e4 100644 --- a/src/timeline/TimelineFilter.cpp +++ b/src/timeline/TimelineFilter.cpp @@ -123,7 +123,16 @@ TimelineFilter::fetchAgain() return; if (auto s = source(); s && incrementalSearchIndex == std::numeric_limits::max()) { - if (this->rowCount() == cachedCount && s->canFetchMore(QModelIndex())) + if (this->rowCount() == cachedCount && s->canFetchMore(QModelIndex()) && + // If we already have the event id of the thread in the timeline and we are filtering by + // thread, we can stop fetching more messages In theory an event could have been edited + // earlier in the timeline into the thread. So in theory this check is insufficient and + // we should instead verify that all events referring to this thread are in the timeline + // instead of just the thread root, but only Nheko supports that atm and the check would + // be expensive. + // TODO(Nico): check that all thread referrencing events are in the timeline by also + // checking all edits inside the thread. + (threadId.isEmpty() || s->idToIndex(threadId) == -1)) s->fetchMore(QModelIndex()); else cachedCount = this->rowCount(); -- cgit 1.4.1