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

fix: MultiSelectElement does not allow for options w/ { id: '0' } #334

Merged
merged 1 commit into from
Dec 5, 2024

Conversation

rclankhorst
Copy link
Contributor

I've noticed that with API generated enum types which initialize at index 0, specifically MultiSelectElement tends to misbehave. After some digging I realised that a logical OR operation when rendering chosen options would consider the value '0' to be falsy, and attempt to render the whole item from options instead of just its value. It subsequently causes [object Object] to be rendered, allows for selecting said entry more than once without being disabled, and when showChips is set to true, it would even outright crash the renderer.

I've changed the operation to be null-coalescing instead, and updated Storybook to advertise the change.

If there's anything I need to clarify, don't hesitate to ask.

Copy link

vercel bot commented Dec 4, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-hook-form-material-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 4, 2024 2:32pm

@rclankhorst
Copy link
Contributor Author

The failing CI stage relates to a type-check error which is introduced in a previous commit. Once that's solved, this PR should be updated, and it should pass without issues.

@dohomi dohomi merged commit c9fca0e into dohomi:master Dec 5, 2024
1 of 2 checks passed
@dohomi
Copy link
Owner

dohomi commented Dec 5, 2024

released with the latest version thx for your PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants