From 61c6f29313fec90745f3fcff0aa1594b397ca6f5 Mon Sep 17 00:00:00 2001 From: AsadAzam Date: Wed, 21 Sep 2022 20:14:46 +0500 Subject: [PATCH] Revert "fix: add response duplication button fixed" This reverts commit 8baec0bd4bfdbabe677bee19804099e4de2a2aa7. --- src/discussions/comments/CommentsView.jsx | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) 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 ( <>
@@ -86,7 +81,7 @@ function DiscussionCommentsView({ {sortedComments.map(comment => ( ))} - {!!sortedComments.length && !isClosed && showAddResponse + {!!sortedComments.length && !isClosed && } {hasMorePages && !isLoading && (