From 1238ba9f8a78b5de8af2df09598caf78c0227690 Mon Sep 17 00:00:00 2001 From: olexh Date: Thu, 16 May 2024 15:21:30 +0300 Subject: [PATCH] fix: vote in comment thread --- .../[content_type]/[slug]/[[...comment_reference]]/page.tsx | 4 ++-- components/comments/components/comment-vote.tsx | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/(pages)/comments/[content_type]/[slug]/[[...comment_reference]]/page.tsx b/app/(pages)/comments/[content_type]/[slug]/[[...comment_reference]]/page.tsx index c5c98b41..72d994a8 100644 --- a/app/(pages)/comments/[content_type]/[slug]/[[...comment_reference]]/page.tsx +++ b/app/(pages)/comments/[content_type]/[slug]/[[...comment_reference]]/page.tsx @@ -15,7 +15,6 @@ import Content from './components/content'; import ContentHeader from './components/content-header'; import { getContent } from './components/useContent'; - export async function generateMetadata(): Promise { return _generateMetadata({ title: `Коментарі`, @@ -73,11 +72,12 @@ const CommentsPage: FC = async ({ params }) => { comment_reference && (await queryClient.prefetchQuery({ queryKey: ['commentThread', comment_reference], - queryFn: () => + queryFn: ({ meta }) => getCommentThread({ params: { reference: comment_reference, }, + auth: meta?.auth, }), })); diff --git a/components/comments/components/comment-vote.tsx b/components/comments/components/comment-vote.tsx index 5861b2a2..fe7783f6 100644 --- a/components/comments/components/comment-vote.tsx +++ b/components/comments/components/comment-vote.tsx @@ -1,4 +1,4 @@ -import React, { FC } from 'react'; +import { FC } from 'react'; import BxBxsDownvote from '~icons/bx/bxs-downvote'; import BxBxsUpvote from '~icons/bx/bxs-upvote'; import BxDownvote from '~icons/bx/downvote'; @@ -24,6 +24,9 @@ const CommentVote: FC = ({ comment }) => { mutationFn: vote, onSuccess: async () => { await queryClient.invalidateQueries({ queryKey: ['comments'] }); + await queryClient.invalidateQueries({ + queryKey: ['commentThread'], + }); }, });