mirror of
				https://github.com/langgenius/dify.git
				synced 2025-11-04 04:43:09 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			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,
 | 
						|
      },
 | 
						|
    )
 | 
						|
  }
 | 
						|
}
 |