From b5ef881a18b644e02cef0de36adf01d8fe507fd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?nicole=20miko=C5=82ajczyk?= Date: Sun, 1 Mar 2026 21:49:13 +0100 Subject: [PATCH] nicolium: fix nonsense memoization 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/contexts.ts | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/packages/nicolium/src/stores/contexts.ts b/packages/nicolium/src/stores/contexts.ts index 5bf3cedfd..085767764 100644 --- a/packages/nicolium/src/stores/contexts.ts +++ b/packages/nicolium/src/stores/contexts.ts @@ -291,23 +291,11 @@ const useThread = (statusId?: string, linear?: boolean) => { }, [inReplyTos, replies, statusId, linear]); }; -const useReplyToId = (statusId?: string) => { - const inReplyTos = useContextStore((state) => state.inReplyTos); +const useReplyToId = (statusId?: string) => + useContextStore((state) => (statusId ? state.inReplyTos[statusId] : undefined)); - return useMemo(() => { - if (!statusId) return undefined; - return inReplyTos[statusId]; - }, [inReplyTos, statusId]); -}; - -const useReplyCount = (statusId?: string) => { - const replies = useContextStore((state) => state.replies); - - return useMemo(() => { - if (!statusId) return 0; - return replies[statusId]?.length || 0; - }, [replies, statusId]); -}; +const useReplyCount = (statusId?: string) => + useContextStore((state) => (statusId ? (state.replies[statusId]?.length ?? 0) : 0)); const useContextsActions = () => useContextStore((state) => state.actions);