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
commit 34519de3b7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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,
})
},
)
}
}