Don't sort and ignore duplicate comments (embed-stream)

This commit is contained in:
Chi Vinh Le
2017-08-28 18:08:33 +07:00
parent 8a5db167ff
commit f9bc5f79ec
6 changed files with 16 additions and 35 deletions
@@ -6,7 +6,7 @@ import {withFragments, connect} from 'plugin-api/beta/client/hocs';
import Comment from '../containers/Comment';
import {addNotification} from 'plugin-api/beta/client/actions/notification';
import {viewComment} from 'coral-embed-stream/src/actions/stream';
import {getDefinitionName} from 'plugin-api/beta/client/utils';
import {appendNewNodes, getDefinitionName} from 'plugin-api/beta/client/utils';
import update from 'immutability-helper';
class TabPaneContainer extends React.Component {
@@ -27,7 +27,7 @@ class TabPaneContainer extends React.Component {
asset: {
featuredComments: {
nodes: {
$push: comments.nodes,
$apply: (nodes) => appendNewNodes(nodes, comments.nodes),
},
hasNextPage: {$set: comments.hasNextPage},
endCursor: {$set: comments.endCursor},
@@ -9,7 +9,7 @@ import ModTag from './containers/ModTag';
import ModSubscription from './containers/ModSubscription';
import {findCommentInEmbedQuery} from 'coral-embed-stream/src/graphql/utils';
import {insertCommentsSorted} from 'plugin-api/beta/client/utils';
import {prependNewNodes} from 'plugin-api/beta/client/utils';
export default {
reducer,
@@ -60,7 +60,7 @@ export default {
asset: {
featuredComments: {
nodes: {
$apply: (nodes) => insertCommentsSorted(nodes, comment, 'DESC')
$apply: (nodes) => prependNewNodes(nodes, [comment]),
}
},
featuredCommentsCount: {