From d71d3a597127d541dcd18378a7aa140cacdb4f8b Mon Sep 17 00:00:00 2001 From: plebeius Date: Thu, 8 Jan 2026 14:34:52 +0100 Subject: [PATCH] remove unnecessary comments --- src/components/topbar/topbar.tsx | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/components/topbar/topbar.tsx b/src/components/topbar/topbar.tsx index 4b9b24fa..ce332519 100644 --- a/src/components/topbar/topbar.tsx +++ b/src/components/topbar/topbar.tsx @@ -102,18 +102,13 @@ const TopBarDesktop = () => { // Memoize allBoardCodes since it's derived from a constant const allBoardCodes = useMemo(() => getAllBoardCodes(), []); - // Use accounts store with selective subscriptions to avoid rerenders from updatingState - // Only subscribe to subscriptions array and account subplebbit addresses const subscriptions = useAccountsStore( (state) => { const activeAccountId = state.activeAccountId; const activeAccount = activeAccountId ? state.accounts[activeAccountId] : undefined; - // Spread to create new reference - if array is mutated in place, the equality - // function needs different references to detect content changes return [...(activeAccount?.subscriptions || [])]; }, (prev, next) => { - // Shallow compare arrays - only rerender if subscriptions actually change if (prev.length !== next.length) return false; return prev.every((val, idx) => val === next[idx]); }, @@ -127,7 +122,6 @@ const TopBarDesktop = () => { return Object.keys(accountSubplebbits); }, (prev, next) => { - // Shallow compare arrays - only rerender if addresses actually change if (prev.length !== next.length) return false; return prev.every((val, idx) => val === next[idx]); }, @@ -270,8 +264,6 @@ const TopBarMobile = ({ subplebbitAddress }: { subplebbitAddress: string }) => { const boardPath = useBoardPath(subplebbitAddress); const selectValue = isInAllView ? 'all' : isInSubscriptionsView ? 'subs' : boardPath || subplebbitAddress; - // Use accounts store with selective subscriptions to avoid rerenders from updatingState - // Only subscribe to account subplebbit addresses (keys only) const accountSubplebbitAddresses = useAccountsStore( (state) => { const activeAccountId = state.activeAccountId; @@ -280,7 +272,6 @@ const TopBarMobile = ({ subplebbitAddress }: { subplebbitAddress: string }) => { return Object.keys(accountSubplebbits); }, (prev, next) => { - // Shallow compare arrays - only rerender if addresses actually change if (prev.length !== next.length) return false; return prev.every((val, idx) => val === next[idx]); }, @@ -357,7 +348,8 @@ const TopBarMobile = ({ subplebbitAddress }: { subplebbitAddress: string }) => { const TopBar = () => { const params = useParams(); - const accountComment = useAccountComment({ commentIndex: params?.accountCommentIndex as any }); + const commentIndex = params?.accountCommentIndex ? parseInt(params.accountCommentIndex) : undefined; + const accountComment = useAccountComment({ commentIndex }); const resolvedSubplebbitAddress = useResolvedSubplebbitAddress(); const subplebbitAddress = resolvedSubplebbitAddress || accountComment?.subplebbitAddress;