-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[SwitchBase] Fix ignoring disabled from FormControl #19319
[SwitchBase] Fix ignoring disabled from FormControl #19319
Conversation
Details of bundle changes.Comparing: 528a603...b3cd783
|
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.
Thanks for working on this. Could you add a test illustrating the underlying issue?
@mbrookes, do you want me to revert all the default props that were set with a purpose to satisfy Framer X or we're good with these three? |
This comment has been minimized.
This comment has been minimized.
@eps1lon's question is clear (I reacted with a thumbs up), I'll add the test My question to @mbrookes is about extra default props he added while adding Framer X. Since we can configure default prop outside of the code we ship to the users, we might wanna rollback that changes and add default prop values to |
@rostislavbobo Thanks for working on this, and for taking the time to wrap your head around the Framer code, which can be a bit convoluted. Good to see the automatic code generation paying dividends for newly introduced props. For a while it seemed more trouble than it was worth. 😅 To answer your question - unless there are other components that have an implicit dependency on a prop being undefined in order to determine its behaviour (is that a code smell?), then I think we are good with the other defaults. |
I think the actual code smell is computing some variable from context and props. Just like a component instance should either read from state or props (but not switch between) we shouldn't listen to context and props. It's a general issue with our form components where But we have to live with this for now. In v5 we should revisit this and decide if something lives in props or context. |
eeeb594
to
4580023
Compare
describeConformance(<Checkbox checked />, () => ({ | ||
classes, | ||
inheritComponent: IconButton, | ||
mount, | ||
refInstanceof: window.HTMLSpanElement, | ||
skip: ['componentProp'], | ||
after: () => mount.cleanUp(), |
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.
Yeah that is a bit obscure if you're unfamiliar with the testing setup. Glad that you figured this out for yourself 👍
@rostislavbobo Great first pull request 👍. Happy to assist in future work. |
Resolves #19288
Resets [Checkbox][Radio][Switch]
disabled
prop back toundefined
The key point was to support Framer X so that these components keep behaving the same