-
Notifications
You must be signed in to change notification settings - Fork 182
Removed internal state from several input components #2433
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
Conversation
Looks good to me, but I think @alisterdev should review it since he's more familiar with the JS being modified. @jstirling91 says that the Form.js was written for the instrument builder, so can you make sure that's tested with this change? |
Yeah actually @alisterdev already found a couple issues with this that need to be addressed (mostly updates to code using these components). I'll make sure to test instrument builder too. |
@driusan Instrument builder uses form elements simply to display UI (i.e no input), hence it is not affected by this change. (also I tested it to make sure) |
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.
- Update familyInfo.js, uploadForm.js, editForm.js to make sure values are passed as props to components
- Don't show empty field error by default
- Rebase
These components were duplicating/mirroring state when they could simply use props. This change gives us a single source of truth for state and is more in line with React best practices.
461437d
to
b5a0ab1
Compare
So, I found how to fix the bugs without major code changes and pushed all the necessary updates. |
* Removed internal state from several input components These components were duplicating/mirroring state when they could simply use props. This change gives us a single source of truth for state and is more in line with React best practices. * Only show input errors for requried fields when empty string is passed * Update form elements used in media * Pass values to form elements
* Removed internal state from several input components These components were duplicating/mirroring state when they could simply use props. This change gives us a single source of truth for state and is more in line with React best practices. * Only show input errors for requried fields when empty string is passed * Update form elements used in media * Pass values to form elements
* Removed internal state from several input components These components were duplicating/mirroring state when they could simply use props. This change gives us a single source of truth for state and is more in line with React best practices. * Only show input errors for requried fields when empty string is passed * Update form elements used in media * Pass values to form elements
* Removed internal state from several input components These components were duplicating/mirroring state when they could simply use props. This change gives us a single source of truth for state and is more in line with React best practices. * Only show input errors for requried fields when empty string is passed * Update form elements used in media * Pass values to form elements
These components were duplicating/mirroring state when they could use props instead. This change gives us a single source of truth for state and is more in line with the React idiom of preferring controlled components to uncontrolled ones.