-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[joy-ui][RadioGroup] Allow zero number as a value #40344
[joy-ui][RadioGroup] Allow zero number as a value #40344
Conversation
The reason for this change is that the Radio component didn't work when there was a value of 0 since !!0 => false, this way we explicitly check for undefined/null.
Netlify deploy previewhttps://deploy-preview-40344--material-ui.netlify.app/ Bundle size reportDetails of bundle changes (Toolpad) |
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.
Thank you so much for the fix! one last request, can you add a test for this?
…eck the initial value of Radio
Yep, just added two tests - one is for the initial value and one to check the value when clicking on the Radio elements. 🙌🏼 I also made sure to check if the tests failed with the old code, and they did. |
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.
Looks good! Thank you for the contribution!
The reason for this change is that the Radio component didn't work when there was a value of 0 since !!0 => false, this way we explicitly check for undefined/null.
Closes: #40342
Before: https://stackblitz.com/edit/react-cs6xw6?file=Demo.tsx
After: https://codesandbox.io/p/sandbox/joy-ui-cra-ts-forked-pjnwf8?file=%2Fsrc%2FApp.tsx%3A25%2C1