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

[Masonry] Fix flickering when used with React 18 #33163

Merged
merged 1 commit into from
Jun 20, 2022

Conversation

mnajdova
Copy link
Member

@mnajdova mnajdova commented Jun 15, 2022

When used in React 18, there is a visible flickering in the Masonry component. See #32518 reproduction: https://codesandbox.io/s/b83ug2 (try to open/close some of the accordions and notice the flickering).

I could find one relevant issue on React's repo facebook/react#24331 where the suggestion is to batch the states updates in the ResizeObserver's callback together.

Codesandbox using the packages from this PR

Fixes #32518


If this is the right fix for this issue, we are likely going to go through all usages of ResizeObserver and ensure that there are no more bugs similar to this one.

@mnajdova mnajdova added bug 🐛 Something doesn't work component: masonry This is the name of the generic UI component, not the React module! labels Jun 15, 2022
@mui-bot
Copy link

mui-bot commented Jun 15, 2022

Details of bundle changes

Generated by 🚫 dangerJS against 42fdc5e

@mnajdova mnajdova marked this pull request as ready for review June 15, 2022 16:18
Copy link
Member

@eps1lon eps1lon left a comment

Choose a reason for hiding this comment

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

Great PR description 👍🏻

You might be hitting an issue that's actively being worked on in facebook/react#24594.

The fix looks fine though.

I'd recommend checking if you can still reproduce this issue when using an experimental build from facebook/react#24594 (might need to build locally and ensure the enableFrameEndScheduling is set i.e. @experimental is built).

I'm not sure if facebook/react#24594 is meant to address facebook/react#24331 but it'd be valueable feedback nontheless.

@mnajdova
Copy link
Member Author

Thanks for the quick feedback @eps1lon, sure will test out tomorrow with the build from facebook/react#24594 to see if I can reproduce the issue.

@mnajdova
Copy link
Member Author

The bug is still there with the current build from facebook/react#24594 (I've set the variable enableFrameEndScheduling locally true everywhere, built the packages and used those in the cra with the repro).

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: masonry This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Masonry] Extra column temporarily when items with large variable height change are used
3 participants