diff --git a/src/core/client/stream/mutations/CreateCommentReactionMutation.ts b/src/core/client/stream/mutations/CreateCommentReactionMutation.ts index 2a044d758..f0e079e7d 100644 --- a/src/core/client/stream/mutations/CreateCommentReactionMutation.ts +++ b/src/core/client/stream/mutations/CreateCommentReactionMutation.ts @@ -18,15 +18,7 @@ const mutation = graphql` mutation CreateCommentReactionMutation($input: CreateCommentReactionInput!) { createCommentReaction(input: $input) { comment { - id - actionCounts { - reaction { - total - } - } - myActionPresence { - reaction - } + ...ReactionButtonContainer_comment } clientMutationId } @@ -36,6 +28,12 @@ const mutation = graphql` let clientMutationId = 0; function commit(environment: Environment, input: CreateCommentReactionInput) { + const source = environment.getStore().getSource(); + + const currentCount = source.get( + source.get(source.get(input.commentID)!.actionCounts.__ref)!.reaction.__ref + )!.total; + return commitMutationPromiseNormalized(environment, { mutation, variables: { @@ -51,6 +49,7 @@ function commit(environment: Environment, input: CreateCommentReactionInput) { myActionPresence: { reaction: true, }, + actionCounts: currentCount, }, clientMutationId: (clientMutationId++).toString(), }, diff --git a/src/core/client/stream/mutations/DeleteCommentReactionMutation.ts b/src/core/client/stream/mutations/DeleteCommentReactionMutation.ts index d05e8faf0..ea1a0acde 100644 --- a/src/core/client/stream/mutations/DeleteCommentReactionMutation.ts +++ b/src/core/client/stream/mutations/DeleteCommentReactionMutation.ts @@ -13,15 +13,7 @@ const mutation = graphql` mutation DeleteCommentReactionMutation($input: CreateCommentReactionInput!) { deleteCommentReaction(input: $input) { comment { - id - actionCounts { - reaction { - total - } - } - myActionPresence { - reaction - } + ...ReactionButtonContainer_comment } clientMutationId } diff --git a/src/core/client/stream/tabs/comments/components/ReactionButton.tsx b/src/core/client/stream/tabs/comments/components/ReactionButton.tsx index ec8df5749..206c0e2ab 100644 --- a/src/core/client/stream/tabs/comments/components/ReactionButton.tsx +++ b/src/core/client/stream/tabs/comments/components/ReactionButton.tsx @@ -18,8 +18,8 @@ class ReactionButton extends React.Component { const { totalReactions, reacted } = this.props; return (