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

Pass pageSWRs to swrDataToOffset #52

Merged
merged 6 commits into from Nov 6, 2019
Merged

Pass pageSWRs to swrDataToOffset #52

merged 6 commits into from Nov 6, 2019

Conversation

shuding
Copy link
Member

@shuding shuding commented Oct 31, 2019

There're many common use cases like #44, which needs the SWR data of all pages to determine the offset.

This PR changes the signature of swrDataToOffset to

(data, pageSWRs) => offset

so you can use

(data, pageSWRs) => data.hasNextPage ? pageSWRs.length : null

to set the current page number as the offset.

Todo

  • create tests for useSWRPages

@shuding shuding removed the on hold label Nov 1, 2019
@shuding shuding mentioned this pull request Nov 4, 2019
@pacocoursey pacocoursey merged commit 80c4b3f into master Nov 6, 2019
@pacocoursey pacocoursey deleted the add-swrs-to-pages branch November 6, 2019 01:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants