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
Describe the bug
I generated the files for nextjs approuter using fetch. I noticed the prefetch isnt working, because the queryKey is generated differently in the generated code, meaning that React-query think it's 2 different queries.
Describe the bug
I generated the files for nextjs approuter using fetch. I noticed the prefetch isnt working, because the queryKey is generated differently in the generated code, meaning that React-query think it's 2 different queries.
See the querykey in the prefetch.ts:
queryClient.prefetchQuery({ queryKey: [ Common.useQuestionairesServiceQuestionaireControllerFindKey, [{ filterId, limit, page, search, searchBy, sortBy }] ], queryFn: () => QuestionairesService.questionaireControllerFind({ filterId, limit, page, search, searchBy, sortBy }) });
Now see the querykey in the queries.ts:
useQuery<TData, TError>({ queryKey: Common.UseQuestionairesServiceQuestionaireControllerFindKeyFn( { filterId, limit, page, search, searchBy, sortBy }, queryKey ), queryFn: () => QuestionairesService.questionaireControllerFind({ filterId, limit, page, search, searchBy, sortBy }) as TData, ...options });
This results in 2 different keys in queries:
To Reproduce
Steps to reproduce the behavior:
Generate the files using this script:
"codegen": "rimraf ./openapi && openapi-rq -i https://our-url/api.json -c fetch && prettier --write .",
I can easily fix this in the generated code by using the same querykey generation method in the queries.ts as in the prefetch.ts
If there's any way for you guys to fix this, or to give me a solid work around, that'd be great!
The text was updated successfully, but these errors were encountered: