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

TanstackQuery: Generated Infinite Queries won't compile with "full" DataReturnType #746

Closed
joaomlneto opened this issue Dec 23, 2023 · 0 comments · Fixed by #747
Closed
Labels
bug Something isn't working

Comments

@joaomlneto
Copy link

joaomlneto commented Dec 23, 2023

What version of kubb is running?

kubb/2.1.0 darwin-arm64 node-v20.9.0

What platform is your computer?

MacOS

What version of external packages are you using(@tanstack-query, MSW, React, Vue, ...)

  "dependencies": {
    "@kubb/cli": "^2.1.0",
    "@kubb/core": "^2.1.0",
    "@kubb/swagger": "^2.1.0",
    "@kubb/swagger-client": "^2.1.0",
    "@kubb/swagger-tanstack-query": "^2.1.0",
    "@kubb/swagger-ts": "^2.1.0",
    "@kubb/swagger-zod": "^2.1.0",
    "@kubb/swagger-zodios": "^2.1.0",
    "@tanstack/react-query": "^5.14.2",
    "@zodios/core": "^10.9.6",
    "axios": "^1.6.2",
    "react": "18.2.0",
    "zod": "^3.22.4"
  },

What steps can reproduce the bug?

  1. Generate infinite queries
  2. Use dataReturnType value of full
      createSwaggerTanstackQuery({
        client: {
          importPath: "../../client",
        },
        dataReturnType: "full",
        infinite: {},
      }),

How often does this bug happen?

Every time

What is the expected behavior?

With dataReturnType: full the generated infinite query should access lastPage.data.length instead of lastPage.length.

Expected:

getNextPageParam: (lastPage, allPages, lastPageParam) => lastPage.data.length === 0 ? undefined : lastPageParam + 1,

Actual:

getNextPageParam: (lastPage, allPages, lastPageParam) => lastPage.length === 0 ? undefined : lastPageParam + 1,

Swagger/OpenAPI file?

Schema available at https://esi.evetech.net/latest/swagger.json . However, due to limitations of the OpenAPI parser (swagger-codegen), I'm deleting the /route/{origin}/{destination}/ path:

curl -L https://esi.evetech.net/latest/swagger.json | jq 'del(.paths."/route/{origin}/{destination}/")' > swagger.json

Additional information

No response

@joaomlneto joaomlneto added the bug Something isn't working label Dec 23, 2023
@joaomlneto joaomlneto changed the title Generated Infinite Queries won't work with "full" DataReturnType TanstackQuery: Generated Infinite Queries won't work with "full" DataReturnType Dec 23, 2023
@joaomlneto joaomlneto changed the title TanstackQuery: Generated Infinite Queries won't work with "full" DataReturnType TanstackQuery: Generated Infinite Queries won't compile with "full" DataReturnType Dec 23, 2023
@stijnvanhulle stijnvanhulle linked a pull request Dec 23, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant