From 930d020f2aa71046d9386de33089af519f94f031 Mon Sep 17 00:00:00 2001 From: miteruzo Date: Sat, 21 Mar 2026 15:41:05 +0900 Subject: [PATCH] #61 --- frontend/src/components/TagDetailSidebar.tsx | 6 ++++++ frontend/src/types.ts | 14 +++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/frontend/src/components/TagDetailSidebar.tsx b/frontend/src/components/TagDetailSidebar.tsx index 8579442..c02eca9 100644 --- a/frontend/src/components/TagDetailSidebar.tsx +++ b/frontend/src/components/TagDetailSidebar.tsx @@ -6,6 +6,7 @@ import { DndContext, useSensor, useSensors } from '@dnd-kit/core' import { restrictToWindowEdges } from '@dnd-kit/modifiers' +import { useQueryClient } from '@tanstack/react-query' import { motion } from 'framer-motion' import { useEffect, useMemo, useRef, useState } from 'react' @@ -19,6 +20,7 @@ import SidebarComponent from '@/components/layout/SidebarComponent' import { toast } from '@/components/ui/use-toast' import { CATEGORIES, CATEGORY_NAMES } from '@/consts' import { apiDelete, apiGet, apiPatch, apiPost } from '@/lib/api' +import { postsKeys, tagsKeys } from '@/lib/queryKeys' import { dateString, originalCreatedAtString } from '@/lib/utils' import type { DragEndEvent } from '@dnd-kit/core' @@ -152,6 +154,8 @@ type Props = { post: Post; sp?: boolean } export default (({ post, sp }: Props) => { sp = Boolean (sp) + const qc = useQueryClient () + const baseTags = useMemo (() => { const tagsTmp = { } as TagByCategory @@ -181,6 +185,8 @@ export default (({ post, sp }: Props) => { const reloadTags = async (): Promise => { setTags (buildTagByCategory (await apiGet (`/posts/${ post.id }`))) + qc.invalidateQueries ({ queryKey: postsKeys.root }) + qc.invalidateQueries ({ queryKey: tagsKeys.root }) } const onDragEnd = async (e: DragEndEvent) => { diff --git a/frontend/src/types.ts b/frontend/src/types.ts index caaac6e..36f8b32 100644 --- a/frontend/src/types.ts +++ b/frontend/src/types.ts @@ -133,13 +133,13 @@ export type Tag = { matchedAlias?: string | null } export type Theatre = { - id: number - name: string | null - opensAt: string - closesAt: string | null - createdByUser: { id: number; name: string } - createdAt: string - updatedAt: string } + id: number + name: string | null + opensAt: string + closesAt: string | null + createdByUser: { id: number; name: string } + createdAt: string + updatedAt: string } export type User = { id: number