Skip to content

Commit

Permalink
fix: refetch comment after reply
Browse files Browse the repository at this point in the history
  • Loading branch information
Innei committed Jul 26, 2023
1 parent fcc07ec commit d5771c8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/widgets/comment/CommentBox/ActionBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,13 @@ const SubmitButton = () => {
? '感谢你的回复!'
: '感谢你的评论!'

const commentListQueryKey = buildQueryKey(commentRefId)

if (isReply) {
toast.success(toastCopy)
jotaiStore.set(textAtom, '')

queryClient.invalidateQueries(buildQueryKey(originalRefId))
queryClient.invalidateQueries(commentListQueryKey)
return
}

Expand All @@ -272,7 +274,7 @@ const SubmitButton = () => {
}
>
>
>(buildQueryKey(commentRefId), (oldData) => {
>(commentListQueryKey, (oldData) => {
if (!oldData) return oldData
return produce(oldData, (draft) => {
draft.pages[0].data.unshift(data)
Expand Down

1 comment on commit d5771c8

@vercel
Copy link

@vercel vercel bot commented on d5771c8 Jul 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

shiro – ./

shiro-git-main-innei.vercel.app
springtide.vercel.app
innei.in
shiro-innei.vercel.app

Please sign in to comment.