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

In usePaginationFragment onComplete callback for loadNext missing incremental data payloads #4855

Open
Phat-Loc opened this issue Nov 27, 2024 · 2 comments

Comments

@Phat-Loc
Copy link

Per the documentation https://relay.dev/docs/api-reference/use-pagination-fragment/#behavior

loadNext: Function used to fetch more items in the connection in the "forward" direction.
Arguments:
count: Number that indicates how many items to query for in the pagination request.
options: [Optional] options object
onComplete: Function that will be called whenever the refetch request has completed, including any incremental data payloads. If an error occurs during the request, onComplete will be called with an Error object as the first parameter.

When the callback onComplete is called there is no incremental data supplied? How can I get the increment page that was fetched from the server?

const handlePageLoad = (page) => { console.log(page) }

const handlePaginationModelChange = (newPaginationModel: GridPaginationModel) => { loadNext(newPaginationModel.pageSize, {onComplete: handlePageLoad}) };

@lynnshaoyu
Copy link
Contributor

the documentation is not saying that incremental data is an input argument of onComplete, but rather that the function you supply in onComplete will be called on every incremental data load.

@Phat-Loc
Copy link
Author

Is there a way to get the incremental page load?

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

No branches or pull requests

2 participants