From 3ca86bcc0c2588969b69fe30b471872d3d30e20f Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Tue, 4 Apr 2023 23:06:07 -0400 Subject: [PATCH] fix: Draft comment on text gets into a strange state when unfocused --- app/scenes/Document/components/CommentThread.tsx | 6 ++++-- app/stores/CommentsStore.ts | 3 +-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/scenes/Document/components/CommentThread.tsx b/app/scenes/Document/components/CommentThread.tsx index 8d7830d27..21f3775b7 100644 --- a/app/scenes/Document/components/CommentThread.tsx +++ b/app/scenes/Document/components/CommentThread.tsx @@ -68,7 +68,9 @@ function CommentThread({ comment: thread, }); - const commentsInThread = comments.inThread(thread.id); + const commentsInThread = comments + .inThread(thread.id) + .filter((comment) => !comment.isNew); useOnClickOutside(topRef, (event) => { if ( @@ -180,7 +182,7 @@ function CommentThread({ }, }} > - {focused && ( + {(focused || commentsInThread.length === 0) && ( { return filter( this.orderedData, (comment) => - comment.parentCommentId === threadId || - (comment.id === threadId && !comment.isNew) + comment.parentCommentId === threadId || comment.id === threadId ); }