diff --git a/src/discussions/comments/CommentsView.jsx b/src/discussions/comments/CommentsView.jsx index e1966c97..70ecd792 100644 --- a/src/discussions/comments/CommentsView.jsx +++ b/src/discussions/comments/CommentsView.jsx @@ -46,12 +46,12 @@ function usePostComments(postId, endorsed = null) { page: 1, })); }, [postId]); - return [ + return { comments, hasMorePages, isLoading, handleLoadMoreResponses, - ]; + }; } function DiscussionCommentsView({ @@ -61,20 +61,15 @@ function DiscussionCommentsView({ endorsed, isClosed, }) { - const [ + const { comments, hasMorePages, isLoading, handleLoadMoreResponses, - ] = usePostComments(postId, endorsed); - + } = usePostComments(postId, endorsed); const sortedComments = useMemo(() => orderBy(comments, ['endorsed', 'createdAt'], ['desc', 'desc'])); - const [commentList] = usePostComments(postId, EndorsementStatus.UNENDORSED); - - const showAddResponse = endorsed === EndorsementStatus.ENDORSED ? !commentList.length : true; - return ( <>