From 089b979b04203a6e4fd2b01fd5c8091baded4728 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?nicole=20miko=C5=82ajczyk?= Date: Mon, 23 Feb 2026 16:44:09 +0100 Subject: [PATCH] nicolium: forgot to hit save MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: nicole mikołajczyk --- .../src/features/status/components/thread.tsx | 33 ++----------------- 1 file changed, 2 insertions(+), 31 deletions(-) diff --git a/packages/pl-fe/src/features/status/components/thread.tsx b/packages/pl-fe/src/features/status/components/thread.tsx index d8e2d81c8..ca87abc40 100644 --- a/packages/pl-fe/src/features/status/components/thread.tsx +++ b/packages/pl-fe/src/features/status/components/thread.tsx @@ -19,7 +19,7 @@ import { useUnfavouriteStatus, useUnreblogStatus, } from '@/queries/statuses/use-status-interactions'; -import { useContextStore, useThread } from '@/stores/contexts'; +import { useThread } from '@/stores/contexts'; import { useModalsActions } from '@/stores/modals'; import { useSettings } from '@/stores/settings'; import { useStatusMetaActions } from '@/stores/status-meta'; @@ -34,28 +34,6 @@ import type { SelectedStatus } from '@/selectors'; import type { Account } from 'pl-api'; import type { VirtuosoHandle } from 'react-virtuoso'; -const getLinearThreadStatusesIds = ( - statusId: string, - inReplyTos: Record, - replies: Record, -) => { - let parentStatus: string = statusId; - - while (inReplyTos[parentStatus]) { - parentStatus = inReplyTos[parentStatus]; - } - - const threadStatuses = [parentStatus]; - - for (let i = 0; i < threadStatuses.length; i++) { - for (const reply of replies[threadStatuses[i]] || []) { - if (!threadStatuses.includes(reply)) threadStatuses.push(reply); - } - } - - return threadStatuses.toSorted(); -}; - interface IThread { status: SelectedStatus; withMedia?: boolean; @@ -88,14 +66,7 @@ const Thread = ({ const { mutate: unreblogStatus } = useUnreblogStatus(status.id); const linear = displayMode === 'linear'; - const inReplyTos = useContextStore((state) => state.inReplyTos); - const replies = useContextStore((state) => state.replies); - const nestedThread = useThread(status.id); - - const thread = useMemo( - () => (linear ? getLinearThreadStatusesIds(status.id, inReplyTos, replies) : nestedThread), - [linear, status.id, inReplyTos, replies, nestedThread], - ); + const thread = useThread(status.id, linear); const statusIndex = thread.indexOf(status.id); const initialIndex = isModal && statusIndex !== 0 ? statusIndex + 1 : statusIndex;