fix: enhance chunk list management with new invalidation keys and imp… (#12396)

ok
This commit is contained in:
Wu Tianwei
2025-01-06 18:22:16 +08:00
committed by GitHub
parent 147d578922
commit 34519de3b7
3 changed files with 60 additions and 25 deletions

View File

@@ -1,13 +1,15 @@
import {
type QueryKey,
useQueryClient,
} from '@tanstack/react-query'
export const useInvalid = (key: string[]) => {
export const useInvalid = (key: QueryKey) => {
const queryClient = useQueryClient()
return () => {
queryClient.invalidateQueries(
{
queryKey: key,
})
},
)
}
}