mirror of https://github.com/langgenius/dify.git
27 lines
450 B
TypeScript
27 lines
450 B
TypeScript
import {
|
|
type QueryKey,
|
|
useQueryClient,
|
|
} from '@tanstack/react-query'
|
|
|
|
export const useInvalid = (key: QueryKey) => {
|
|
const queryClient = useQueryClient()
|
|
return () => {
|
|
queryClient.invalidateQueries(
|
|
{
|
|
queryKey: key,
|
|
},
|
|
)
|
|
}
|
|
}
|
|
|
|
export const useReset = (key: QueryKey) => {
|
|
const queryClient = useQueryClient()
|
|
return () => {
|
|
queryClient.resetQueries(
|
|
{
|
|
queryKey: key,
|
|
},
|
|
)
|
|
}
|
|
}
|