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

Don't trigger onPageChange while loading #753

Merged
merged 1 commit into from
Mar 27, 2023

Conversation

robincsamuel
Copy link
Contributor

@robincsamuel robincsamuel commented Mar 19, 2023

Related Issue

#233

Description

In our application, we encountered an issue where the onPageChange function was continuously firing until the remote data request was complete when the totalCount was less than the current page. This caused the table to crash with the Maximum update depth exceeded error.

Solution

The proposed solution is to check the isLoading state before triggering the onPageChange function. This approach ensures that the function is only called when the data is not loading, preventing the Maximum update depth exceeded error.

Additional Notes

Here's the codesandbox I created to demonstrate the original issue. To replicate the problem, please navigate to the last page of the table and delete the last item. Please note, the data function is mimicking an API response in order to simulate a deletion.

@robincsamuel robincsamuel requested a review from oze4 as a code owner March 19, 2023 07:22
@robincsamuel
Copy link
Contributor Author

@Domino987 @oze4 I just wanted to check in and see if you had a chance to review the PR. Thanks :)

@Domino987
Copy link
Contributor

Hi, ill check it out today or tomorrow. Thank you.

@robincsamuel
Copy link
Contributor Author

@Domino987 Thanks for the review :) Can you tell me when this can be merged?

@Domino987
Copy link
Contributor

Probably today and then I'll release it

@Domino987 Domino987 merged commit 51773d1 into material-table-core:master Mar 27, 2023
@Domino987
Copy link
Contributor

Done and realesed

@robincsamuel robincsamuel deleted the patch-1 branch March 27, 2023 13:52
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