kubb-labs / kubb

OpenAPI to TypeScript, React-Query, Zod, Zodios, Faker.js, MSW and Axios.
https://kubb.dev
MIT License
552 stars 38 forks source link

Cannot change param name from 'page' to 'cursor'. getNextPageParam: (lastPage) => lastPage["cursor"], returns the cursor as page="cursorValue" #1053

Open gentrith44belt opened 1 week ago

gentrith44belt commented 1 week ago

What version of kubb is running?

v2.19.5

What platform is your computer?

MacOS

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

5

What steps can reproduce the bug?

Basically the issue is that I cannot change {page: pageParam} to be something like {cursor: ''}, whatever getNextPageParam returns it is appended to page

image image

    const getProjectsQuery = useGetProjectsInfinite(
        {
            filter: debouncedFilter.trim(),
        },
        {
            query: {
                initialPageParam: 0,
                getNextPageParam: (lastPage) => {
                    return lastPage.data?.cursor;
                },
            },
        }
    );
stijnvanhulle commented 1 week ago

Setting infinite.queryParam to 'cursor' does not work in the kubb.config.js?

gentrith44belt commented 1 week ago

@stijnvanhulle Actually it does, but is that supposed to be used for page based pagination? We use two strategies for infinite loading, cursor based and page based, so seems that it is not possible to generate different query param names for different strategies?