-
-
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
[Radio] Fix support for number value type #26772
Conversation
Could we add a test case too? |
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.
I don't think we should do this. Comparing arrays by their string value does not make much sense. People should explicitly stringify the value if they wish to.
This becomes especially confusing if the type changes over time
This comment has been minimized.
This comment has been minimized.
@eps1lon The PR is a draft PR. It is not ready for being reviewed. Please look at the following link: https://codesandbox.io/s/create-react-app-with-typescript-forked-qlk19?file=/src/App.tsx After a user clicks
Please let me comment on it after I fix the above problem. It is not about Material-UI but JavaScript. |
ebc3b65
to
5fc9a7e
Compare
I have pushed a new commit with a test case, only to support data structures with a decent I wasn't too sure if we needed to support rich data structure as object or array:
#26333 was about numbers, so maybe we can defer this "object" aspect. |
Totally agree, |
@siriwatknp @oliviertassinari Look to me the PR can be closed. I was thinking about supporting any for Radio value. @siriwatknp helped change support to number/string. Support to number/string is enough to resolve #26333, and so I think the change was ok. @oliviertassinari helped add a test case and reorganized the utility function |
We were really close, I'm reopening |
@oliviertassinari could you tell me what else needs to be done? Not following the PR for a while, so not sure what is going on. |
401a416
to
3006f4a
Compare
@sakura90 We only need a rebase, done :) |
@eps1lon Is #26772 (review) still up to date? The PR now focuses on fixing the support for number values. It works more closely to a native |
Sorry. But if use Radio with FormControlLabel in RadioGroup - problem remained. |
I have followed (at least) the PR section of the contributing guide.
Modified Radio value to any. Implemented exactly like the Select [Select] Improve the value comparison function #13408. Made
areEqualValues
as an util function so both Select and Radio can use it.Modified RadioGroup defaultValue to any.
Updated API documentation.
Closes #26333