Skip to content

[Autocomplete] Prevent renderValue from being skipped when value is 0 #46145

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

Merged
merged 9 commits into from
May 14, 2025

Conversation

LakshitAgarwal
Copy link
Contributor

@LakshitAgarwal LakshitAgarwal commented May 14, 2025

Screenshot 2025-05-14 at 12 23 01 PM

Fixes #46131

@mui-bot
Copy link

mui-bot commented May 14, 2025

Netlify deploy preview

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

Bundle size report

Details of bundle changes (Toolpad)
Details of bundle changes

Generated by 🚫 dangerJS against ca12679

Copy link
Contributor

@0210shivam 0210shivam left a comment

Choose a reason for hiding this comment

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

I think the explicit check for value !== undefined is redundant, as value != null already covers both null and undefined.

@LakshitAgarwal
Copy link
Contributor Author

I think the explicit check for value !== undefined is redundant, as value != null already covers both null and undefined.

okay i'll just remove that and raise a new PR, if that works?

@0210shivam
Copy link
Contributor

No need to raise a new PR — you can amend the commit and push to the same branch to update this one.

@LakshitAgarwal
Copy link
Contributor Author

okay i just did. Thanks

Copy link
Contributor

@0210shivam 0210shivam left a comment

Choose a reason for hiding this comment

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

Thanks for the update! One small note — no need to strictly check for null here, != null is sufficient.

@zannager zannager added the component: autocomplete This is the name of the generic UI component, not the React module! label May 14, 2025
@ZeeshanTamboli ZeeshanTamboli changed the title falsy autocomplete issue fixed [Autocomplete] Fix renderValue does not render falsy values May 14, 2025
@ZeeshanTamboli ZeeshanTamboli changed the title [Autocomplete] Fix renderValue does not render falsy values [Autocomplete] Prevent renderValue from being skipped when value is 0 May 14, 2025
@LakshitAgarwal
Copy link
Contributor Author

Thanks for the update! One small note — no need to strictly check for null here, != null is sufficient.

i didn't really get that. Is that not what I did?

@0210shivam
Copy link
Contributor

I was suggesting to remove the strict check (like value !== null) — remove the extra equals sign — and use != null instead.

@ZeeshanTamboli ZeeshanTamboli added the bug 🐛 Something doesn't work label May 14, 2025
@LakshitAgarwal
Copy link
Contributor Author

got it! Just made the necessary changes

@LakshitAgarwal
Copy link
Contributor Author

Can this branch be merged now? And this issue be close?

Copy link
Member

@ZeeshanTamboli ZeeshanTamboli left a comment

Choose a reason for hiding this comment

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

@LakshitAgarwal Thanks for the fix! I’ve added a test case as well.

@ZeeshanTamboli ZeeshanTamboli merged commit 3f35cdb into mui:master May 14, 2025
19 checks passed
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: autocomplete 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.

[Autocomplete] renderValue does not render falsy values
5 participants