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

Cannot generate strictly suspense query hooks #1098

Closed
ezequiel opened this issue Dec 5, 2023 · 3 comments · Fixed by #1100
Closed

Cannot generate strictly suspense query hooks #1098

ezequiel opened this issue Dec 5, 2023 · 3 comments · Fixed by #1100
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@ezequiel
Copy link
Contributor

ezequiel commented Dec 5, 2023

What are the steps to reproduce this issue?

module.exports = {
  api: {
    input: '../docs/swagger.json',
    output: {
      target: 'api.ts',
      mode: 'split',
      client: 'react-query',
      override: {
        query: {
          useQuery: false,
          useInfinite: false,
          useSuspenseQuery: true,
          useSuspenseInfiniteQuery: true,
        },
      },
      workspace: 'src/api',
    },
  },
};

What happens?

No query hooks are generated. Only mutations are generated. There seems to be a bug where useQuery must be true, otherwise nothing generates

What were you expecting to happen?

Hooks containing useSuspenseQuery, useSuspenseInfiniteQuery are generated (and not useQuery or useInfiniteQuery, as I don't want usages of those functions in my project)

What versions are you using?

Operating System: Mac OS Ventura
Package Version: Latest
Browser Version: Chrome latest

@ezequiel ezequiel changed the title Cannot generate strictly suspense queries Cannot generate strictly suspense query hooks Dec 5, 2023
@ezequiel
Copy link
Contributor Author

ezequiel commented Dec 5, 2023

I think we're missing the Suspense variants here: https://github.com/anymaniax/orval/blob/master/packages/query/src/index.ts#L1134-L1137

This condition would also need to be changed if we wish to generate strictly Suspense hooks: https://github.com/anymaniax/orval/blame/master/packages/query/src/index.ts#L1198

@melloware
Copy link
Collaborator

@georgiev-anton

@melloware
Copy link
Collaborator

PR's are welcome!

@melloware melloware added the enhancement New feature or request label Dec 5, 2023
ezequiel added a commit to ezequiel/orval that referenced this issue Dec 5, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@melloware melloware added this to the 6.22.0 milestone Dec 5, 2023
anymaniax pushed a commit that referenced this issue Dec 6, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
fixes #1098
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants