Skip to content

Commit f9f8f07

Browse files
authored
fix: remove dependency array from comments re-rendering (#2177)
1 parent 8fc2370 commit f9f8f07

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

packages/react/src/components/Comments/Comment.tsx

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,17 @@ export const Comment = ({
5151

5252
const dict = useDictionary();
5353

54-
const commentEditor = useCreateBlockNote(
55-
{
56-
initialContent: comment.body,
57-
trailingBlock: false,
58-
dictionary: {
59-
...dict,
60-
placeholders: {
61-
emptyDocument: dict.placeholders.edit_comment,
62-
},
54+
const commentEditor = useCreateBlockNote({
55+
initialContent: comment.body,
56+
trailingBlock: false,
57+
dictionary: {
58+
...dict,
59+
placeholders: {
60+
emptyDocument: dict.placeholders.edit_comment,
6361
},
64-
schema: editor.comments.commentEditorSchema || defaultCommentEditorSchema,
6562
},
66-
[comment.body],
67-
);
63+
schema: editor.comments.commentEditorSchema || defaultCommentEditorSchema,
64+
});
6865

6966
const Components = useComponentsContext()!;
7067

packages/react/src/components/Comments/Comments.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const Comments = ({
2323
// Maps all comments to elements.
2424
const comments = thread.comments.map((comment, index) => (
2525
<Comment
26-
key={comment.id}
26+
key={comment.id + JSON.stringify(comment.body || "{}")}
2727
thread={thread}
2828
comment={comment}
2929
showResolveButton={index === 0}

0 commit comments

Comments
 (0)