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
exhaustive-deps incorrectly treats zod schema as a dependency
Steps to reproduce
I have this code, which I use in useQuery calls:
import{z}from'zod'interfaceValidateRequestParams<TSchema>{schema: TSchemarequest: (...params: Array<unknown>)=>Promise<unknown>}exportasyncfunctionvalidatedRequest<TSchemaextendsz.ZodTypeAny>({
schema,
request,}: ValidateRequestParams<TSchema>){constresponse=awaitrequest()returnschema.parse(response)asz.infer<TSchema>}constFeatureFlagsSchema=z.string().array()exportconstqueries={root: ()=>['featureFlags'],getAll: ()=>queryOptions({queryKey: queries.root(),// ^^^^^^^^^^^^^^^^^^^^^^^^ The following dependencies are missing in your queryKey: FeatureFlagsSchemaqueryFn: ()=>validatedRequest({schema: FeatureFlagsSchema,request: ()=>Api.get(`/api/v1/features`),}),}),}
There have been multiple similar reports, some fixed, but it seems it’s still an issue.
Describe the bug
exhaustive-deps incorrectly treats zod schema as a dependency
Steps to reproduce
I have this code, which I use in
useQuery
calls:There have been multiple similar reports, some fixed, but it seems it’s still an issue.
Dependencies:
Expected behavior
I expect it to not report external values as dependencies
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
irrelevant I believe
Tanstack Query adapter
react-query
TanStack Query version
v5.53.2
TypeScript version
5.5.4
Additional context
No response
The text was updated successfully, but these errors were encountered: