-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[DataGrid] autoPageSize does not work anymore #1334
Comments
I can't reproduce: https://codesandbox.io/s/material-demo-forked-sifup?file=/demo.tsx Please provide a minimal reproduction test case with the latest version. This would help a lot 👷 . |
Thx for checking @oliviertassinari This must be specific to our environment then, I'll try to give more context and a reproducible example. David |
@oliviertassinari I managed to reproduce the issue, but a little bit differently in https://codesandbox.io/s/charming-brook-os2os?file=/src/Demo.js The problem appears when you change the page, while in my app I get it on the first page directly. In the codesandbox example if you go up to page 3 and com back, you'll see that only one row is displayed. Change the dependency to alpha.23 in package.json and the problem is gone. Cheers ! David |
@ddolcimascolo Thanks for the reproduction. Yeap, it looks completely broken, indeed. I could isolate the origin of the reproduction down to #1319. |
Ok, I spent 30 minutes looking into this. Merely to force me to better understand how the product works. It seems that #1319 is only the tip of the iceberg. The changes there look correct. However, I believe they surface something that is wrong. We have However, in This fix seems to do it: diff --git a/packages/grid/_modules_/grid/hooks/root/useGridContainerProps.ts b/packages/grid/_modules_/grid/hooks/root/useGridContainerProps.ts
index 5fbebef9..0396e856 100644
--- a/packages/grid/_modules_/grid/hooks/root/useGridContainerProps.ts
+++ b/packages/grid/_modules_/grid/hooks/root/useGridContainerProps.ts
@@ -134,15 +134,19 @@ export const useGridContainerProps = (
if (options.autoPageSize || options.autoHeight || !isVirtualized) {
// we don't need vertical virtualization in these cases.
const viewportPageSize =
- options.autoHeight || !isVirtualized
+ options.autoHeight
? rowsCount
: Math.floor(viewportSizes.height / rowHeight);
+ const virtualRowsCount =
+ options.autoHeight || !isVirtualized
+ ? rowsCount
+ : Math.floor(viewportSizes.height / rowHeight);
const requiredHeight = viewportPageSize * rowHeight + scrollBarState.scrollBarSize.x;
const indexes: GridContainerProps = {
isVirtualized,
- virtualRowsCount: viewportPageSize,
- renderingZonePageSize: viewportPageSize,
+ virtualRowsCount,
+ renderingZonePageSize: virtualRowsCount,
viewportPageSize,
totalSizes: {
width: columnsTotalWidth, It restores viewportPageSize !== virtualRowsCount |
Current Behavior 😯
autoPageSize
does not work anymore in v4.0.0-alpha.24. Only one row is displayed while there are room for more.Expected Behavior 🤔
autoPageSize
works and N rows are displayed. This works in v4.0.0-alpha.23Steps to Reproduce 🕹
Steps:
autoPageSize
with v4.0.0-alpha.23. Have enough height for at least 2 rowsContext 🔦
Our build started to fail because a test expects 3 rows to be displayed, but only one is show. I just opened a browser to confirm
Your Environment 🌎
`npx @material-ui/envinfo`
Problem exists in Chrome. Firefox not tested
The text was updated successfully, but these errors were encountered: