Skip to content

Commit 4a777dc

Browse files
committed
hotfix: newComments deduplication ID mismatch, filter null comments from freshNewComments
1 parent e7ac94d commit 4a777dc

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

components/show-new-comments.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function prepareComments (client, newComments) {
2020
}
2121

2222
return fragment
23-
})
23+
}).filter(Boolean)
2424

2525
// count the total number of comments including nested comments
2626
let ncomments = data.ncomments + freshNewComments.length

components/use-live-comments.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ function mergeNewComment (item, newComment) {
110110
const existingComments = item.comments?.comments || []
111111

112112
// is the incoming new comment already in item's new comments or existing comments?
113-
if (existingNewComments.some(c => c.id === newComment.id) || existingComments.some(c => c.id === newComment.id)) {
113+
if (existingNewComments.includes(newComment.id) || existingComments.some(c => c.id === newComment.id)) {
114114
return item
115115
}
116116

0 commit comments

Comments
 (0)