Refetch after invalidate doesn't respect the enabled false
In react query v5 I'm facing the same problem described here https://github.com/TanStack/query/issues/1965.
After a mutation I'm calling the query invalidation function with refetch type 'all' and it is calling the queryFn even if it's disabled. it is someone else facing the same issue?
4 Replies
deep-jade•15mo ago
disabled queries are filtered out by refetchQueries and invalidateQueries: https://github.com/TanStack/query/blob/79e52029975d8a889ffafd7e161010d4997af219/packages/query-core/src/queryClient.ts#L310
GitHub
query/packages/query-core/src/queryClient.ts at 79e52029975d8a889ff...
🤖 Powerful asynchronous state management, server-state utilities and data fetching for the web. TS/JS, React Query, Solid Query, Svelte Query and Vue Query. - TanStack/query
harsh-harlequinOP•15mo ago
I'm using the version 5.45.1, and please check this video, I have a disabled query and the query it's being refetched after I ran an invalidation
harsh-harlequinOP•15mo ago
I'm doing the invalidation and the refetch in this way:
queryClient.invalidateQueries({ queryKey: organizationsQueryKeys.all, refetchType: 'all' });
Maybe I'm lost, but if a query is disabled
if has 0 observers and is not active
, how the refetchType works if we set the value to inactive
?deep-jade•15mo ago
Please shown a minimal reproduction