Disable optimistic pagination to fetch events edited into the thread before the threadroot

fixes #1661
pull/1662/head
Nicolas Werner 10 months ago
parent 51236c3260
commit 8ca0f61cad
No known key found for this signature in database
GPG Key ID: C8D75E610773F2D9
  1. 11
      src/timeline/TimelineFilter.cpp

@ -123,7 +123,16 @@ TimelineFilter::fetchAgain()
return; return;
if (auto s = source(); s && incrementalSearchIndex == std::numeric_limits<int>::max()) { if (auto s = source(); s && incrementalSearchIndex == std::numeric_limits<int>::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()); s->fetchMore(QModelIndex());
else else
cachedCount = this->rowCount(); cachedCount = this->rowCount();

Loading…
Cancel
Save