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] Grid constantly updating a columns width which causes "flickering" #16170

Open
dil-abokor opened this issue Jan 14, 2025 · 16 comments
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! feature: Rendering layout Related to the data grid Rendering engine support: docs-feedback Feedback from documentation page

Comments

@dil-abokor
Copy link

dil-abokor commented Jan 14, 2025

Steps to reproduce

Steps:

  1. Open this link to live example This is the official Docs page.
  2. Reduce the width of the window, and at one point, the Grid starts to "shake".

Current behavior

Screen.Recording.2025-01-14.at.15.18.16.mov

It happens with Chrome and Firefox too.

Expected behavior

The Grid changes it's layout when we're resizing the window and stays in that state.

Context

I think it is only happening when the Grid uses flex column widths.
As you can see on the video, the "Column menu" cell keeps changing between being in one line or two.
If I inspect the DOM, a div with class MuiDataGrid-scrollbarFiller MuiDataGrid-scrollbarFiller-borderTop keeps appearing and disappearing.

Your environment

It is happening with all recent versions locally, and on the Docs page it happens when switching it to v8 alpha as well.

npx @mui/envinfo
  System:
    OS: macOS 14.7.1
  Binaries:
    Node: 20.10.0 - ~/.nvm/versions/node/v20.10.0/bin/node
    npm: 10.2.3 - ~/.nvm/versions/node/v20.10.0/bin/npm
    pnpm: 9.12.3 - ~/.nvm/versions/node/v20.10.0/bin/pnpm
  Browsers:
    Chrome: 131.0.6778.265
    Edge: 131.0.2903.147
    Safari: 17.6
  npmPackages:
    @emotion/react:  11.13.0 
    @emotion/styled:  11.13.0 
    @mui/icons-material: ^5.16.11 => 5.16.11 
    @mui/material: ^5.16.11 => 5.16.11 
    @mui/x-data-grid-pro: 7.19.0 => 7.19.0 
    react:  18.2.0 
    react-dom:  18.2.0 

Search keywords: data grid, layout, width, flickering

@dil-abokor dil-abokor added bug 🐛 Something doesn't work status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 14, 2025
@github-actions github-actions bot changed the title [Data Grid] Grid constantly updating a columns width which causes "flickering" [data grid] Grid constantly updating a columns width which causes "flickering" Jan 14, 2025
@github-actions github-actions bot added the component: data grid This is the name of the generic UI component, not the React module! label Jan 14, 2025
@michelengelen
Copy link
Member

This only happens on the docs page, so it is most probably unrelated to any grid specific feature. @KenanYusuf could you have a look?

@michelengelen michelengelen added feature: Rendering layout Related to the data grid Rendering engine support: docs-feedback Feedback from documentation page and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 15, 2025
@github-project-automation github-project-automation bot moved this to 🆕 Needs refinement in MUI X Data Grid Jan 15, 2025
@dil-abokor
Copy link
Author

dil-abokor commented Jan 15, 2025

I was able to reproduce this locally as well. And it was also raised by our QA.

I think it is related to the maxHeight behaviour when the column widths are fluid, and the column height is "auto".

@michelengelen
Copy link
Member

@dil-abokor we recently deprecated autoHeight on the datagrid (#14614) ... if you encountered this in your app could you please provide a reproduction in code? This would help us a lot in finding the bug

@dil-abokor
Copy link
Author

dil-abokor commented Jan 15, 2025

I managed to reproduce it here:
https://codesandbox.io/p/sandbox/7myvqw?file=%2Fsrc%2FApp.js

EDIT: This shows the bug for me in Chorme and Edge but not in Firefox. If it looks perfect, try modifying the width of the container slightly. Until the first cells content doesn't fit in one line.

@dil-abokor
Copy link
Author

Screen.Recording.2025-01-15.at.15.55.30.mov

@lauri865
Copy link
Contributor

I can't reproduce it, but curious if #15627 would fix it, as I removed the possibility for recursively updating viewport inner size in that PR that seems to have been the cause for similar issues that have so far been fixed with pixel rounding.

@lauri865
Copy link
Contributor

@dil-abokor
Copy link
Author

dil-abokor commented Jan 17, 2025

Yes, I can reproduce it on this url as well

Screen.Recording.2025-01-17.at.08.25.59.mov

@KenanYusuf
Copy link
Member

@dil-abokor are you able to reproduce it on this demo? I've removed maxHeight from the <DataGrid /> and applied a flex layout to the parent.

https://codesandbox.io/p/sandbox/16170-auto-height-flickering-pldl3f

@dil-abokor
Copy link
Author

Yes, it is still happening

@KenanYusuf
Copy link
Member

Ok thanks @dil-abokor. Just to be sure it's related to the auto row height feature, if you comment out getRowHeight={() => "auto"}, it no longer flickers?

@dil-abokor
Copy link
Author

Exactly. If I comment it out, it doesn't happen.

@lauri865
Copy link
Contributor

lauri865 commented Jan 17, 2025

Think it's fixed here now?
https://deploy-preview-15627--material-ui-x.netlify.app/x/react-data-grid/demo/

Steps to reproduce:

  1. On OSX make sure scrollbars are set to always visible in system settings, under Appearance
  2. Resize window so that HTML width is around 1058px

Reproducible here: https://next.mui.com/x/react-data-grid/demo/
Can't reproduce in the above deploy anymore

@dil-abokor
Copy link
Author

@lauri865 I opened both links within the same browser and same width, and you're right, it is not flickering and I can't make it produce the bug anymore.

@lauri865
Copy link
Contributor

lauri865 commented Jan 17, 2025

#15648 also fixes it now that I think about it, but in a better way. Removes another source of dimension recursion that doesn't require rounding pixels.

https://deploy-preview-15648--material-ui-x.netlify.app/x/react-data-grid/demo/

Combination of both of the PRs should improve resize and mount performance (under some circumstances at least).

@dil-abokor
Copy link
Author

#15648 also fixes it now that I think about it, but in a better way. Removes another source of dimension recursion that doesn't require rounding pixels.

https://deploy-preview-15648--material-ui-x.netlify.app/x/react-data-grid/demo/

I can confirm, it is working fine on this preview too.

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! feature: Rendering layout Related to the data grid Rendering engine support: docs-feedback Feedback from documentation page
Projects
Status: 🆕 Needs refinement
Development

No branches or pull requests

4 participants