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

[material-ui][Autocomplete] Fix default value for multiple mode getting redefined with React 19 #43189

Merged

Conversation

DiegoAndai
Copy link
Member

@DiegoAndai DiegoAndai commented Aug 5, 2024

Part of: #42824

I couldn't find a reason in the React 19 upgrade guide for why this change was necessary. What I understand is that because the array is being defined on every render, it's not stable. Users would have to change this as well when upgrading to React 19.

@DiegoAndai DiegoAndai added package: material-ui Specific to @mui/material component: autocomplete This is the name of the generic UI component, not the React module! labels Aug 5, 2024
@DiegoAndai DiegoAndai requested a review from aarongarciah August 5, 2024 19:14
@DiegoAndai DiegoAndai self-assigned this Aug 5, 2024
@DiegoAndai DiegoAndai changed the title [material-ui][Autocomplete] Fix default value for multiple mode getting redefined [material-ui][Autocomplete] Fix default value for multiple mode getting redefined with React 19 Aug 5, 2024
@DiegoAndai DiegoAndai added the React 19 support About improving React 19 support label Aug 5, 2024
@mui-bot
Copy link

mui-bot commented Aug 5, 2024

Netlify deploy preview

https://deploy-preview-43189--material-ui.netlify.app/

Bundle size report

Details of bundle changes (Toolpad)
Details of bundle changes

Generated by 🚫 dangerJS against 7e14306

Copy link
Member

@aarongarciah aarongarciah left a comment

Choose a reason for hiding this comment

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

Looks good

@DiegoAndai DiegoAndai requested a review from michaldudak August 5, 2024 21:24
@DiegoAndai
Copy link
Member Author

@michaldudak does this change make sense to you?

Without these, the "controlled to uncontrolled" error throws here:

https://github.com/mui/material-ui/blob/next/packages/mui-utils/src/useControlled/useControlled.js#L38

Just double checking if there's no better solution here.

Copy link
Member

@michaldudak michaldudak left a comment

Choose a reason for hiding this comment

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

It makes sense for sure 👍. I'm just not aware why this started to be a problem only now with React 19.

@DiegoAndai
Copy link
Member Author

I'm just not aware why this started to be a problem only now with React 19.

I was wondering the same 😅

Thanks fro reviewing!

@DiegoAndai DiegoAndai merged commit eba9593 into mui:next Aug 6, 2024
22 checks passed
@DiegoAndai DiegoAndai deleted the react-19-autocomplete-default-multiple branch August 6, 2024 12:12
DiegoAndai added a commit to DiegoAndai/material-ui that referenced this pull request Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: autocomplete This is the name of the generic UI component, not the React module! package: material-ui Specific to @mui/material React 19 support About improving React 19 support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants