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

Adding initialPageParam and nested nextPageParam support #143

Merged
merged 5 commits into from
Sep 16, 2024

Conversation

adamgoose
Copy link
Contributor

@adamgoose adamgoose commented Aug 23, 2024

This adds a new argument --initialPageParam to customize the initialPageParam option passed to useInfiniteQuery. Defaults to 1.

Fixes #141.


When nextPageParam is set to meta.nextPage, split on . and generate the appropriately nested typehint:

  getNextPageParam: response => (response as {
    meta: {
      nextPage: number;
    };
  }).meta.nextPage

Fixes #142.

@seriouslag seriouslag added the enhancement New feature or request label Aug 24, 2024
Copy link
Collaborator

@seriouslag seriouslag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great change!

If you don't mind documenting the change in the readme that would be awesome. Thanks.

@adamgoose
Copy link
Contributor Author

I've combined my two PRs into this one to prevent having to rebase and re-generate the snapshots between merges. I've also added docs as requested. 👍

@adamgoose adamgoose requested a review from seriouslag August 26, 2024 16:39
@adamgoose adamgoose changed the title Adding initialPageParam support Adding initialPageParam and nested nextPageParam support Aug 26, 2024
Copy link
Owner

@7nohe 7nohe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the awesome PR! It looks great!

@7nohe 7nohe merged commit d67c594 into 7nohe:main Sep 16, 2024
4 checks passed
@AnderssonPeter
Copy link

@adamgoose @7nohe this caused a breaking change, if you dont provide the initialPageParam parameter it now defaults to "initialPageParam", before it defaulted to "1"..
It would be nice if it still had 1 as default value.

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 this pull request may close these issues.

Support nested nextPageParam values Support customizing initialPageParam
4 participants