mirror of
https://github.com/wassname/talk.git
synced 2026-09-10 12:43:11 +08:00
Don't sort and ignore duplicate comments (embed-stream)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import update from 'immutability-helper';
|
||||
import {insertCommentsSorted} from 'coral-framework/utils';
|
||||
import {appendNewNodes} from 'coral-framework/utils';
|
||||
|
||||
function determineCommentDepth(comment) {
|
||||
let depth = 0;
|
||||
@@ -159,14 +159,7 @@ function findAndInsertFetchedComments(parent, comments, parent_id) {
|
||||
[connectionField]: {
|
||||
hasNextPage: {$set: comments.hasNextPage},
|
||||
endCursor: {$set: comments.endCursor},
|
||||
nodes: {$apply: (nodes) => {
|
||||
if (isAsset) {
|
||||
return nodes.concat(comments.nodes);
|
||||
}
|
||||
return insertCommentsSorted(nodes, comments.nodes.filter(
|
||||
(comment) => !nodes.some((node) => node.id === comment.id)
|
||||
));
|
||||
}},
|
||||
nodes: {$apply: (nodes) => appendNewNodes(nodes, comments.nodes)},
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -198,7 +191,7 @@ export function attachCommentToParent(topLevelComment, comment) {
|
||||
return update(topLevelComment, {
|
||||
replies: {
|
||||
nodes: {
|
||||
$apply: (nodes) => insertCommentsSorted(nodes, comment),
|
||||
$apply: (nodes) => appendNewNodes(nodes, [comment]),
|
||||
},
|
||||
},
|
||||
replyCount: {
|
||||
|
||||
Reference in New Issue
Block a user