app/frontend/comments/up_vote_button.component.jsx in decidim-comments-0.0.3 vs app/frontend/comments/up_vote_button.component.jsx in decidim-comments-0.0.5
- old
+ new
@@ -44,11 +44,11 @@
upVote: PropTypes.func.isRequired
};
const UpVoteButtonWithMutation = graphql(gql`
${upVoteMutation}
- ${commentFragment}
+ ${commentFragment}
${commentDataFragment}
${upVoteFragment}
${downVoteFragment}
`, {
props: ({ ownProps, mutate }) => ({
@@ -69,23 +69,26 @@
}
},
updateQueries: {
GetComments: (prev, { mutationResult: { data } }) => {
const commentReducer = (comment) => {
- const replies = comment.replies || [];
+ const replies = comment.comments || [];
if (comment.id === ownProps.comment.id) {
return data.comment.upVote;
}
return {
...comment,
- replies: replies.map(commentReducer)
+ comments: replies.map(commentReducer)
};
};
return {
...prev,
- comments: prev.comments.map(commentReducer)
+ commentable: {
+ ...prev.commentable,
+ comments: prev.commentable.comments.map(commentReducer)
+ }
}
}
}
})
})