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

[DataGrid] Flickering on grid initialization when using flex columns #3212

Closed
2 tasks done
hoangbn opened this issue Nov 17, 2021 · 6 comments · Fixed by #3213
Closed
2 tasks done

[DataGrid] Flickering on grid initialization when using flex columns #3212

hoangbn opened this issue Nov 17, 2021 · 6 comments · Fixed by #3213
Assignees
Labels
component: data grid This is the name of the generic UI component, not the React module! regression A bug, but worse

Comments

@hoangbn
Copy link

hoangbn commented Nov 17, 2021

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

When the table is first rendered, flex columns have some small fixed width, then they expand. This happens very quickly, so it looks like it flickers.
The following gif shows the difference between navigating between 2 different tables (4.0.1 vs 5.0.1). The flickering one is v5

image-loading-issue

Expected behavior 🤔

It should not flicker (it did not do this before I migrated to v5 - 4.0.1)

Steps to reproduce 🕹

The issue can be viewed in the official example sandbox https://codesandbox.io/s/3q8ue?file=/demo.js taken from https://mui.com/components/data-grid/columns/#fluid-width

Steps:

  1. Reload the sandbox render area
  2. See it flicker

Context 🔦

No response

Your environment 🌎

No response

Order ID 💳 (optional)

No response

@hoangbn hoangbn added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Nov 17, 2021
@flaviendelangle
Copy link
Member

flaviendelangle commented Nov 18, 2021

An example in the version 5.0.0-beta.7 without the flickering
https://codesandbox.io/s/columnfluidwidthgrid-material-demo-forked-bvyg6?file=/package.json

I will have a look 👍 , it was probably introduced by #3007

@flaviendelangle flaviendelangle added component: data grid This is the name of the generic UI component, not the React module! regression A bug, but worse and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Nov 18, 2021
@flaviendelangle
Copy link
Member

We are debouncing the resize event to avoid resizing the grid dozens of time when resizing the window.

But debouncing even the 1st resize event mean that the initialization is debounced, causing a render to squeeze between the column init without there flex size (to now if we need a scrollbar) and there update with there flex size.

@flaviendelangle flaviendelangle changed the title Fluid width started flickering in v5 [DataGrid] Flickering on grid initialization when using flex columns Nov 18, 2021
@flaviendelangle flaviendelangle self-assigned this Nov 18, 2021
@ddolcimascolo
Copy link

Can this be related to my issue in #2945 ?

@flaviendelangle
Copy link
Member

At first glance I don't think so but it's not impossible

@ddolcimascolo
Copy link

OK. Cause I do see the flicker too

@flaviendelangle
Copy link
Member

The flicker probably have the same cause

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

Successfully merging a pull request may close this issue.

3 participants