Skip to content
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

Query: getPackageByQueryClient doesn't respect peer dependencies #1559

Closed
navignaw opened this issue Aug 2, 2024 · 1 comment · Fixed by #1560
Closed

Query: getPackageByQueryClient doesn't respect peer dependencies #1559

navignaw opened this issue Aug 2, 2024 · 1 comment · Fixed by #1560
Assignees
Labels
bug Something isn't working tanstack-query TanStack Query related issue
Milestone

Comments

@navignaw
Copy link

navignaw commented Aug 2, 2024

What are the steps to reproduce this issue?

  1. Clone the samples/react-query/basic project, including the package.json and orval.config.js
  2. Edit package.json and move "@tanstack/react-query": "^5.0.0" from dependencies into peerDependencies
  3. Run orval --config ./orval.config.js

What happens?

The generated output does not correctly detect hasQueryV5, and thus fails to generate the appropriate TS interfaces required for v5. For example, the getListPetsInfiniteQueryOptions is missing the ListPetsParams['limit'] type required to make v5 typecheck.

What were you expecting to happen?

The generated output should include the ListPetsParams['limit'] type.

Any logs, error output, etc?

N/A

Any other comments?

We use peer dependencies because we have a shared library that generates react query hooks, which is then used by other projects in a monorepo. It looks like a straightforward solution for now is to move the peer dependency back to devDependencies, but it seems like an easy fix to add peerDependencies to the list in getPackageByQueryClient.

+1 for implementing #1144 which would have made debugging this issue slightly easier :)

What versions are you using?

System:
    OS: macOS 14.5
    CPU: (12) arm64 Apple M3 Pro
    Memory: 783.84 MB / 36.00 GB
    Shell: 5.9 - /bin/zsh
  npmPackages:
    @tanstack/react-query: ^5 => 5.51.18
    orval: 6.31.0 => 6.31.0
@melloware melloware added bug Something isn't working tanstack-query TanStack Query related issue labels Aug 2, 2024
@melloware melloware self-assigned this Aug 2, 2024
@melloware melloware added this to the 7.0.1 milestone Aug 2, 2024
melloware added a commit that referenced this issue Aug 2, 2024
@melloware
Copy link
Collaborator

Thanks @navignaw PR submitted!

@melloware melloware changed the title getPackageByQueryClient doesn't respect peer dependencies Query: getPackageByQueryClient doesn't respect peer dependencies Aug 2, 2024
soartec-lab pushed a commit that referenced this issue Aug 3, 2024
* fix(query): check for peer dependecies

Fix #1559

* Update types.ts

* Update index.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working tanstack-query TanStack Query related issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants