From ce8159f2eabb594b372a7208f2175b9ec3590e4f Mon Sep 17 00:00:00 2001 From: plebeius Date: Tue, 24 Feb 2026 16:42:39 +0800 Subject: [PATCH] fix(board-buttons): use useComment in PostPageStats so reply count shows on direct thread URLs --- src/components/board-buttons/board-buttons.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/components/board-buttons/board-buttons.tsx b/src/components/board-buttons/board-buttons.tsx index 38e5368a..f30397bf 100644 --- a/src/components/board-buttons/board-buttons.tsx +++ b/src/components/board-buttons/board-buttons.tsx @@ -1,7 +1,6 @@ import { useTranslation } from 'react-i18next'; import { Link, useLocation, useNavigate, useParams } from 'react-router-dom'; -import { useAccountComment, useSubscribe } from '@plebbit/plebbit-react-hooks'; -import useSubplebbitsPagesStore from '@plebbit/plebbit-react-hooks/dist/stores/subplebbits-pages'; +import { useAccountComment, useComment, useSubscribe } from '@plebbit/plebbit-react-hooks'; import { isAllView, isCatalogView, isModView, isModQueueView, isPendingPostView, isPostPageView, isSubscriptionsView } from '../../lib/utils/view-utils'; import { useDirectories } from '../../hooks/use-directories'; import { getBoardPath, isDirectoryBoard } from '../../lib/utils/route-utils'; @@ -458,11 +457,14 @@ export const MobileBoardButtons = () => { export const PostPageStats = () => { const { t } = useTranslation(); const params = useParams(); + const commentCid = params?.commentCid as string | undefined; - const comment = useSubplebbitsPagesStore((state) => state.comments[params?.commentCid as string]); + const comment = useComment({ commentCid }); + const postCid = comment?.parentCid ?? commentCid; + const post = useComment({ commentCid: postCid }); - const { closed, pinned, replyCount } = comment || {}; - const linkCount = useCountLinksInReplies(comment); + const { closed, pinned, replyCount } = post || {}; + const linkCount = useCountLinksInReplies(post); const displayReplyCount = replyCount !== undefined ? replyCount.toString() : '?'; const replyCountTooltip = replyCount !== undefined ? capitalize(t('replies')) : t('loading');