-
-
Notifications
You must be signed in to change notification settings - Fork 354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TanStack react query v5 marks queryKey
as required
#975
Comments
queryKey
as requiredqueryKey
as required
This was released in 6.19.1 can you test @leniency please? |
Yup all good now, thanks! |
Still happens, any fix? |
Not many changes since 6.22.1 so look through the commits and see if you can spot it: v6.22.1...master |
The generated code is different, something is removing the Partial<> (6.23.0) query?: UseQueryOptions<Awaited<ReturnType<typeof getDomainValues>>, TError, TData>;
(6.22.1) query?: Partial<UseQueryOptions<Awaited<ReturnType<typeof getDomainValues>>, TError, TData>>; |
@anymaniax I don't see any commit between 6.22.1 and 6.23.0 that would affect this |
So you want to know the reason why I also read this as well. |
Yes I don't see what changed that would cause this between 6.22.1 and 6.23.0. |
@maapteh @ruiaraujo012 @melloware Hi, I checked the operation using
using
I also checked the source code, but could not find any part that would reproduce the problem. |
You're right, I tried again with v6.23.0, and it worked, it created the Partial. |
@ruiaraujo012 |
I thought this would be an easy one. But not. When i isolate the package from my pnpm monorepo and only install what is used in the setup for this generating and just use my own open-api yaml and the petstore yaml from your codebase i do see the Partial. https://github.com/maapteh/orval-maybe-bug/blob/main/src/api/index.ts#L159 |
Thank you for checking too. |
Yes i will ask some extra eyes in our monorepo, the weird thing is that when i run pnpm why i do see the correct versions :( |
found the cullprit.
The V5 version detection was always false. When i override it to true i saw the Partial. Now i have to look why in a pnpm monorepo it cant find the correct version, which has been set in the workspace root (one of the requirements when we build with Bazel unfortunately). For now i just also add it to the workspace itself... :) took me too much time to figure out it was figuring out the correct version itself. Maybe nice to log the version while creating the react-query to confirm this visually :) |
@maapteh thanks for the investigation. Great idea to add the version detected when running. Could you create a feature request for that please? Like that we can also add a warning when we don't find it and provide the default one |
Thanks for the wonderful work Victor. Ticket is created at #1144 |
I had the same issue when running Orval in a npm workspace that had react-query as a peerDependency. It would be nice if it correctly detected that. |
@tlrobinson you can specify which version you want in the config too now |
Could you show an example? I don't see this version option mentioned anywhere in the docs or examples. I am facing the same issue. I have a PNPM Workspace, which uses Orval to generate the hooks for my frontend package based on the OpenAPI spec of the backend package. Since the generation runs on the Workspace level and not in my frontend package itself, I assume this version check is failing. |
something like this module.exports = {
petstore: {
output: {
...
override: {
query: {
version: the version you want
},
},
},
...
},
}; |
This makes adding additional query options annoying as it forces overriding the query key that gets set in the generated code.
This only appears to affect queries and not mutations.
The text was updated successfully, but these errors were encountered: