From 04e68ebc94d3201fd7635fd2942ee59c5a7b2ab4 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Tue, 14 Nov 2023 17:57:08 -0600 Subject: [PATCH] Timeline: always insert new status IDs at the end --- src/reducers/timelines.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/reducers/timelines.ts b/src/reducers/timelines.ts index 021c02283..7b7dd274e 100644 --- a/src/reducers/timelines.ts +++ b/src/reducers/timelines.ts @@ -32,6 +32,7 @@ import { } from '../actions/timelines'; import type { AnyAction } from 'redux'; +import type { ImportPosition } from 'soapbox/entity-store/types'; import type { APIEntity, Status } from 'soapbox/types/entities'; const TRUNCATE_LIMIT = 40; @@ -93,6 +94,7 @@ const expandNormalizedTimeline = ( prev: string | undefined, isPartial: boolean, isLoadingRecent: boolean, + pos: ImportPosition = 'end', ) => { const newIds = getStatusIds(statuses); @@ -113,10 +115,10 @@ const expandNormalizedTimeline = ( if (!newIds.isEmpty()) { timeline.update('items', oldIds => { - if (newIds.first() > oldIds.first()!) { - return mergeStatusIds(oldIds, newIds); - } else { + if (pos === 'end') { return mergeStatusIds(newIds, oldIds); + } else { + return mergeStatusIds(oldIds, newIds); } }); }