7nohe / openapi-react-query-codegen

Node.js library that generates React Query (also called TanStack Query) hooks based on an OpenAPI specification file.
253 stars 25 forks source link

fix: reuse helper to generate keys in prefetch hooks #103

Closed nopitown closed 3 months ago

nopitown commented 4 months ago

Attempting to fix https://github.com/7nohe/openapi-react-query-codegen/issues/102. I'll revisit it tomorrow since I'm still getting familiar with the code. The ultimate goal here is to allow prefetch hooks to be as flexible as query hooks are and create the same key structure so it is possible to use the cache.

7nohe commented 4 months ago

Since an issue (#121 ) regarding this problem has been created again, it seems better to address it quickly, so I will take over.

7nohe commented 4 months ago

@seriouslag I removed the queryKey parameter from prefetch.ts. I have also confirmed that the queryKey matches between the prefetchQuery and useQuery generated in the Next.js sample app.

TomWebbio commented 3 months ago

So when is this getting released? This issue makes it so prefetch is unusable right now for us. It's been approved for 2 weeks.

7nohe commented 3 months ago

@TomWebbio Sorry for the delay. I was sick for the past two weeks and couldn't find time to release it. I will release it now.