Open codeart1st opened 5 months ago
After some discussion this is still useful to get rid of double handled error requests from React Router v6 Loader und UI Components.
// skip fetch, if router loader already finished with an error
const { isError } = fancyApi.endpoints.fancyMethod.useQueryState(args)
const { data, isLoading } = useFancyMethodQuery(isError ? skipToken : args)
Currently, @rtk-query/codegen-openapi generates named export hooks for queries and mutations, but it is missing the useQueryState hooks. I would like to propose an enhancement to include the useQueryState hooks in the generated code. This addition would provide users with convenient access to the useQueryState hooks alongside the existing generated hooks. The useQueryState hooks are a great addition for react router v6 loader strategy. api.endpoints.methodName.useQueryState ist hard to type.
Steps to Reproduce:
Expected Behavior:
The generated code should include the useQueryState hooks for each corresponding query.