From e1a66d389f87a3db96b26cc0184f27d975a701a4 Mon Sep 17 00:00:00 2001 From: zeppi Date: Sat, 2 Apr 2022 09:20:58 -0400 Subject: [PATCH] prevent crash when deleting last reply (still needs work) --- ui/component/commentsReplies/view.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/component/commentsReplies/view.jsx b/ui/component/commentsReplies/view.jsx index d1e0e0923..2bbbc4941 100644 --- a/ui/component/commentsReplies/view.jsx +++ b/ui/component/commentsReplies/view.jsx @@ -44,7 +44,7 @@ function CommentsReplies(props: Props) { const [commentsToDisplay, setCommentsToDisplay] = React.useState(fetchedReplies); const isResolvingReplies = fetchedReplies && resolvedReplies.length !== fetchedReplies.length; const alreadyResolved = !isResolvingReplies && resolvedReplies.length !== 0; - const canDisplayComments = commentsToDisplay && commentsToDisplay.length === fetchedReplies.length; + const canDisplayComments = commentsToDisplay && fetchedReplies && commentsToDisplay.length === fetchedReplies.length; // Batch resolve comment channel urls React.useEffect(() => { @@ -106,7 +106,7 @@ function CommentsReplies(props: Props) { /> )} - {(isFetchingByParentId[parentId] || isResolvingReplies || !canDisplayComments) && ( + {(isFetchingByParentId[parentId] || isResolvingReplies || (!fetchedReplies && !canDisplayComments)) && (