You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When refactoring parts of the queryFn used in useQuery (or queryOptions) into helper functions that involve queryClient, exhaustive-deps will sometimes error on the queryKey thinking that queryClient should be included in it. It's hard to know what's the differentiator for when exhaustive-deps thinks queryClient should be a dependency or not; some helper functions involving queryClient don't trigger the error, while others do.
Build a useQuery whose queryFn uses a queryClient, e.g. in the TS Playground example, to only fetch items that aren't already cached, and individually cache them (this is related to Keys for array of items #712)
Refactor out helper functions for the (get from cache) and (individually cache) portions of the queryFn, as seen in the TS Playground example
See the inconsistent behavior of exhaustive-deps as shown in the playground example(s)
Expected behavior
No errors asking for queryClient to be a dep in queryKey; or at least consistent behavior. But ideally a way to refactor out helper functions (for the sake of clean code) without errors.