[Glitch] Fix “load more” adding older toots/notifications to pending items

Port 577706987d to glitch-soc

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
This commit is contained in:
ThibG
2019-09-18 11:27:10 +02:00
committed by Thibaut Girka
parent 844e0fb48c
commit b840de580f
3 changed files with 7 additions and 6 deletions

View File

@@ -40,7 +40,7 @@ const expandNormalizedTimeline = (state, timeline, statuses, next, isPartial, is
if (timeline.endsWith(':pinned')) {
mMap.set('items', statuses.map(status => status.get('id')));
} else if (!statuses.isEmpty()) {
usePendingItems = usePendingItems || !mMap.get('top') || !mMap.get('pendingItems').isEmpty();
usePendingItems = isLoadingRecent && (usePendingItems || !mMap.get('top') || !mMap.get('pendingItems').isEmpty());
mMap.update(usePendingItems ? 'pendingItems' : 'items', ImmutableList(), oldIds => {
const newIds = statuses.map(status => status.get('id'));
const lastIndex = oldIds.findLastIndex(id => id !== null && compareId(id, newIds.last()) >= 0) + 1;