This commit is contained in:
2026-03-21 15:41:05 +09:00
parent 8ccefd9782
commit 930d020f2a
2 changed files with 13 additions and 7 deletions
@@ -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<TagByCategory> (() => {
const tagsTmp = { } as TagByCategory
@@ -181,6 +185,8 @@ export default (({ post, sp }: Props) => {
const reloadTags = async (): Promise<void> => {
setTags (buildTagByCategory (await apiGet<Post> (`/posts/${ post.id }`)))
qc.invalidateQueries ({ queryKey: postsKeys.root })
qc.invalidateQueries ({ queryKey: tagsKeys.root })
}
const onDragEnd = async (e: DragEndEvent) => {