kimsupin changed the title 'queryClient.invalidateQueries' is not working when Using multiple elements in queryKey array 'queryClient.invalidateQueries' is not working when Using multiple elements in queryKey a
await queryClient.invalidateQueries( { queryKey: ['posts'], exact, refetchType: 'active', }, { throwOnError, cancelRefetch }, ) Options filters?: QueryFilters:Query Filters queryKey?: QueryKey:Query Keys refetchType?: 'active' | 'inactive' | 'all' | 'none' ...
Adding a shouldInvalidatePreviousData option to useQuery. This would allow a developer to write code such as: const { data, loading, error } = useQuery(FIND_DOGS, { variables: { search: searchText }, shouldInvalidatePreviousData(nextVariables, previousVariables) { return nextVariables !== previ...
If youdo not want active queries to refetch, and simply be marked as invalid, you can use therefetchType: 'none'option. If youwant inactive queries to refetchas well, use therefetchType: 'all'option tsx awaitqueryClient.invalidateQueries({queryKey: ['posts'],exact,refetchType:'active',},...