mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix: reply count was bugged
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
import { useMemo } from 'react';
|
||||
import { Comment } from '@plebbit/plebbit-react-hooks';
|
||||
import { flattenCommentsPages } from '@plebbit/plebbit-react-hooks/dist/lib/utils';
|
||||
|
||||
const useReplyCount = (comment: Comment) => {
|
||||
const replies = comment?.replies;
|
||||
const flattenedReplies = useMemo(() => flattenCommentsPages(replies), [replies]);
|
||||
|
||||
return flattenedReplies.length;
|
||||
};
|
||||
|
||||
export default useReplyCount;
|
||||
Reference in New Issue
Block a user