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

[Data Grid] Page size does not reset after clearing a filter when using autoPageSize #1413

Closed
2 tasks done
bahador-worklete opened this issue Apr 14, 2021 · 7 comments
Closed
2 tasks done
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module!

Comments

@bahador-worklete
Copy link

bahador-worklete commented Apr 14, 2021

When using autoPageSize with a DataGrid, if you set a filter and clear it, the page size does not reset.

  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

Let's say I have a DataGrid using autoPageSize with 100 rows, a page size of 20, and 5 pages. If I set a filter that returns 1 row, I will have 1 page with 1 row. If I clear that filter, I now have 100 pages with a page size of 1.

Expected Behavior 🤔

After clearing the filter, I would expect to have 5 pages of 20, just as I started out with when loading the DataGrid.

Steps to Reproduce 🕹

Steps:

  1. Go to this link: https://material-ui.com/components/data-grid/pagination/#auto-size
  2. Create a filter on the Trader Name field using any one of the populated values for that field
  3. Notice that now there is only a single result and that the page size is 1
  4. Clear the filter, and now you will see that the page size remains 1 but that you have 100 pages

Context 🔦

I just want the Data Grid to return to the same size it was when it loaded.

Your Environment 🌎

`npx @material-ui/envinfo`

Chrome Version 89.0.4389.114 (Official Build) (x86_64)

npx: installed 2 in 3.204s

  System:
    OS: macOS 10.15.7
  Binaries:
    Node: 12.21.0 - ~/.nvm/versions/node/v12.21.0/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.14.11 - ~/.nvm/versions/node/v12.21.0/bin/npm
  Browsers:
    Chrome: 89.0.4389.114
    Edge: Not Found
    Firefox: 87.0
    Safari: 13.1.3
  npmPackages:
    @material-ui/core: 4.11.0 => 4.11.0 
    @material-ui/data-grid: ^4.0.0-alpha.23 => 4.0.0-alpha.24 
    @material-ui/icons: ^4.9.1 => 4.9.1 
    @material-ui/lab: ^4.0.0-alpha.56 => 4.0.0-alpha.56 
    @material-ui/styles:  4.10.0 
    @material-ui/system:  4.9.14 
    @material-ui/types:  5.1.0 
    @material-ui/utils:  4.10.2 
    @types/react: ^16.9.44 => 16.9.56 
    react: 16.13.1 => 16.13.1 
    react-dom: 16.13.1 => 16.13.1 
    typescript: 3.9.7 => 3.9.7 
@bahador-worklete bahador-worklete added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Apr 14, 2021
@oliviertassinari
Copy link
Member

Can somebody test that it's the same root cause as #1334? Meaning that the fix we did cover this case too?

@dtassone
Copy link
Member

Yes I checked it does cover it

@bahador-worklete
Copy link
Author

bahador-worklete commented Apr 14, 2021

I tested it on material-ui.com and it's broken there. I'm using 4.0.0-alpha.23 for my project and it's broken there.
Perhaps I'm doing something wrong?

Post Script: I searched for other issues but I guess I missed the one you linked. Forgive me if this is a duplicate. If so, I can move over there.

@dtassone
Copy link
Member

It will be fixed in the next release.

@bahador-worklete
Copy link
Author

Thank you.

@oliviertassinari oliviertassinari added bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Apr 14, 2021
@oliviertassinari
Copy link
Member

Fix released in v4.0.0-alpha.25

@bahador-worklete
Copy link
Author

tyvm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module!
Projects
None yet
Development

No branches or pull requests

3 participants