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

[Autocomplete] Add verbose warning for defaultValue #27925

Merged
merged 3 commits into from Aug 24, 2021

Conversation

vedadeepta
Copy link
Contributor

Fixes: #24785

@mui-pr-bot
Copy link

mui-pr-bot commented Aug 23, 2021

No bundle size changes (experimental)

Generated by 🚫 dangerJS against eea46e1

@vedadeepta vedadeepta force-pushed the 24785-autocomplete-defaultValue-warning branch from 9898167 to a0427f2 Compare August 23, 2021 15:54
'Autocomplete',
);
}).toErrorDev(
'The Autocomplete expects the `defaultValue` prop to be an array or undefined.',
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
'The Autocomplete expects the `defaultValue` prop to be an array or undefined.',
'The Autocomplete expects the `defaultValue` prop to be an array when `multiple={true}` or undefined.',

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, should I change the warning for value prop too, because the condition under which we show the warning are same for both defaultValue & value.

Copy link
Member

Choose a reason for hiding this comment

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

OK, should I change the warning for value prop too

@vedadeepta Yes please. It's the same warning, respectively for the controlled and uncontrolled behavior of the "value" state.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

too late now, should I open a different PR or re-open this one?

Copy link
Member

Choose a reason for hiding this comment

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

A follow-up PR sounds great

@oliviertassinari oliviertassinari changed the title [AutoComplete]: Add verbose warning for defaultValue [Autocomplete] Add verbose warning for defaultValue Aug 23, 2021
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.

Nice warning, thanks!

@eps1lon eps1lon merged commit af74554 into mui:next Aug 24, 2021
@zannager zannager added the component: autocomplete This is the name of the generic UI component, not the React module! label Jan 26, 2023
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!
Projects
None yet
5 participants