-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
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
[base-ui] Fix downstream bundlers remove React 17 useId compatibility #37183
Conversation
Netlify deploy previewhttps://deploy-preview-37183--material-ui.netlify.app/ Bundle size report |
Hey, thanks for looking into this. Can you please share simple reproduction app so that we can validate the fix? |
Hi @mnajdova, would it be sufficient to only create a simple reproduction library, since we can look at the bundle output to see if it retains or loses v17 compatibility? |
If so, here it is: simple reproduction library |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution!
Thanks for the review @mnajdova! What's the next step in the process here? |
Wanted to check back in on this since it's a blocker for us. What needs to happen to get this merged? |
It should be released today! |
This PR is strange, we update useId but not useSyncExternalStore? We have two different solutions for the same problem:
I have left notes in #41190 to fix all instances. |
Summary
Fixes #37182. Based on this commit from floating-ui. I've confirmed that this will resolve the issue by manually tweaking the
useId
code in a local install of@mui/utils
and running it through the same bundle process that's stripping the string concatenation.Bundle output before tweak to confirm fix, using string concatenation in utils source
Note that
+""
has been stripped fromReact3["useId"+""]
on line 15. This is what's causing the downstream build issue.Bundle output after tweak to confirm fix, using
.toString()
in utils sourceNote that the call to
toString
has been preserved on line 15.