How to silence missing queryFn warnings?
I have a project which uses react-query as a generic store (ala zustand). State is set via
setQueryData() or <HydrationBoundary>, and consumed with useQuery as normal. staleTime is set to Infinity so no data fetching occurs.
My understanding is that this is a common use case for react-query. However after a recent update https://github.com/TanStack/query/pull/8701 I get tons of warnings about missing queryFn.
Is there a way to silence the warnings?2 Replies
mute-gold•7mo ago
It's not common and there's no way to silence the warning because it's a misuse / invalid usage of a query
Even with staleTime infinity, queries can be removed, garbage collected, invalidated and need a queryFn to run. We'll likely make it mandatory with v6
If you have no queryFn, it's not a query
If you use it "like zustand", why not really put that in zustand ?
afraid-scarletOP•7mo ago
Thank you! I will look into migrating to zustand for non-async state