From 6c10d9f5ba0a74abde3ca780e8c29aae940ca6f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?nicole=20miko=C5=82ajczyk?= Date: Sat, 7 Mar 2026 17:55:02 +0100 Subject: [PATCH] nicolium: works before further timeline improvements i don't want to do for nwo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: nicole mikołajczyk --- packages/nicolium/src/stores/timelines.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/nicolium/src/stores/timelines.ts b/packages/nicolium/src/stores/timelines.ts index a306638ad..dac9d5942 100644 --- a/packages/nicolium/src/stores/timelines.ts +++ b/packages/nicolium/src/stores/timelines.ts @@ -72,13 +72,12 @@ interface State { const processPage = (statuses: Array): Array => { const timelinePage: Array = []; - const processStatus = (status: Status): boolean => { - if ( - timelinePage.some( - (entry) => entry.type === 'status' && entry.id === (status.reblog || status).id, - ) - ) - return false; + const processStatus = (status: Status) => { + const existingEntry = timelinePage.findIndex( + (entry) => entry.type === 'status' && entry.id === (status.reblog || status).id, + ); + + if (existingEntry !== -1) return existingEntry; let isConnectedTop = false; const inReplyToId = (status.reblog || status).in_reply_to_id; @@ -87,7 +86,8 @@ const processPage = (statuses: Array): Array => { const foundStatus = statuses.find((s) => (s.reblog || s).id === inReplyToId); if (foundStatus) { - if (processStatus(foundStatus)) { + const entryIndex = processStatus(foundStatus); + if (entryIndex === -1) { const lastEntry = timelinePage.at(-1); // it's always of type status but doing this to satisfy ts if (lastEntry?.type === 'status') lastEntry.isConnectedBottom = true; @@ -117,7 +117,7 @@ const processPage = (statuses: Array): Array => { isConnectedTop, }); } - return true; + return -1; } timelinePage.push({ @@ -129,7 +129,7 @@ const processPage = (statuses: Array): Array => { isConnectedTop, }); - return true; + return -1; }; for (const status of statuses) {