Skip to content

Commit

Permalink
Fix new comment threads not appearing
Browse files Browse the repository at this point in the history
Regressed with 80aedb9
  • Loading branch information
CarsonF committed Oct 17, 2024
1 parent e9b72ea commit 44379e0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/components/Comments/CommentForm/CreateComment.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ mutation createComment($input: CreateCommentInput!) {
commentThread {
id
...commentThread
container {
__typename
id
}
}
}
}
11 changes: 7 additions & 4 deletions src/components/Comments/CommentForm/CreateComment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@ export const CreateComment = ({
const { resourceId } = useCommentsContext();

const [createOrReplyComment] = useMutation(CreateCommentDocument, {
update: addItemToList({
listId: 'commentThreads',
outputToItem: (data) => data.createComment.commentThread,
}),
update: (cache, res, options) => {
const thread = res.data!.createComment.commentThread;
addItemToList({
listId: [thread.container, 'commentThreads'],
outputToItem: () => thread,
})(cache, res, options);
},
});

return (
Expand Down

0 comments on commit 44379e0

Please sign in to comment.