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

Fix crash changing from a larger page size to a smaller one #396

Merged
merged 1 commit into from
Nov 13, 2021

Conversation

Cristy94
Copy link
Contributor

@Cristy94 Cristy94 commented Nov 9, 2021

Related Issue

Haven't found an issue in this repo yet.

Description

When using remote data loading with paging and you reduce the the rows per page (from 20 to 15), the app will crash because it will try to render 20 items at a row page size of 15 before data is loaded and emptyRowCount will be -5 which crashes when trying to do Array(-5)

Impacted Areas in Application

List general components of the application that this PR will affect:

Fixed a possible crash when changing page size.

Additional Notes

This is a bug fix.

When using remote data loading with paging and you reduce the the rows per page (from 20 to 15), the app will crash because it will try to render 20 items at a row page size of 15 before data is loaded and `emptyRowCount` will be `-5` which crashes when trying to do `Array(-5)`
@Cristy94 Cristy94 requested a review from oze4 as a code owner November 9, 2021 20:18
Copy link
Contributor

@Domino987 Domino987 left a comment

Choose a reason for hiding this comment

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

This looks good. Thank you!

@Domino987
Copy link
Contributor

Would it be possible for you to add a test to cover this use case as well?

@Cristy94
Copy link
Contributor Author

Cristy94 commented Nov 12, 2021

Would it be possible for you to add a test to cover this use case as well?

I am not familiar with creating tests here, but I can try, mostly it's mocking remote loading and changing page size to a lower value.

I want to say that after making this change my app didn't crash anymore.

@Domino987
Copy link
Contributor

Yes and I will merge it. You could copy one of the tests files and mock the data call.
It would be great if you could create a new PR at one point for this to make the whole project more stable, but no rush.

@Domino987 Domino987 merged commit 8e8a022 into material-table-core:master Nov 13, 2021
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