diff --git a/frontend/src/components/PostList.tsx b/frontend/src/components/PostList.tsx
index 87aacc8..1856bc3 100644
--- a/frontend/src/components/PostList.tsx
+++ b/frontend/src/components/PostList.tsx
@@ -11,10 +11,11 @@ type Props = { posts: Post[]
export default (({ posts, onClick }: Props) => (
{posts.map ((post, i) => (
-
+
& {
export default (({ to,
- replace,
- className,
- onMouseEnter,
- onTouchStart,
- onClick,
- cancelOnError = false,
- ...rest }: Props) => {
+ replace,
+ className,
+ onMouseEnter,
+ onTouchStart,
+ onClick,
+ cancelOnError = false,
+ ...rest }: Props) => {
const navigate = useNavigate ()
const qc = useQueryClient ()
const url = useMemo (() => (new URL (to, location.origin)).toString (), [to])
diff --git a/frontend/src/pages/posts/PostDetailPage.tsx b/frontend/src/pages/posts/PostDetailPage.tsx
index 9f93a12..de4a298 100644
--- a/frontend/src/pages/posts/PostDetailPage.tsx
+++ b/frontend/src/pages/posts/PostDetailPage.tsx
@@ -43,19 +43,19 @@ export default (({ user }: Props) => {
return next
},
onMutate: async () => {
- await qc.cancelQueries ({ queryKey: ['post', String (id)] })
- const prev = qc.getQueryData (['post', String (id)])
- qc.setQueryData (['post', String (id)],
+ await qc.cancelQueries ({ queryKey: ['posts', String (id)] })
+ const prev = qc.getQueryData (['posts', String (id)])
+ qc.setQueryData (['posts', String (id)],
(cur: any) => cur ? { ...cur, viewed: !(cur.viewed) } : cur)
return { prev }
},
onError: (...[, , ctx]) => {
if (ctx?.prev)
- qc.setQueryData (['post', String (id)], ctx.prev)
+ qc.setQueryData (['posts', String (id)], ctx.prev)
toast ({ title: '失敗……', description: '通信に失敗しました……' })
},
onSuccess: () => {
- qc.invalidateQueries ({ queryKey: ['posts'] })
+ qc.invalidateQueries ({ queryKey: ['posts', 'index'] })
qc.invalidateQueries ({ queryKey: ['related', String (id)] })
} })