Skip to content

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

Merged
merged 4 commits into from
Jan 3, 2017

Conversation

jacobpenny
Copy link
Contributor

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.

@driusan
Copy link
Collaborator

driusan commented Nov 22, 2016

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?

@jacobpenny
Copy link
Contributor Author

jacobpenny commented Nov 22, 2016

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.

@jacobpenny jacobpenny added the State: Needs work PR awaiting additional work by the author to proceed label Nov 22, 2016
@alisterdev
Copy link
Contributor

@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)

Copy link
Contributor

@alisterdev alisterdev left a 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.
@alisterdev alisterdev force-pushed the controlled-form-components branch from 461437d to b5a0ab1 Compare December 23, 2016 17:14
@alisterdev
Copy link
Contributor

So, I found how to fix the bugs without major code changes and pushed all the necessary updates.
A final look probably wouldn't hurt @jacobpenny

@alisterdev alisterdev added PassedCodeReview Cleanup PR or issue introducing/requiring at least one clean-up operation and removed State: Needs work PR awaiting additional work by the author to proceed Request Code Review labels Dec 23, 2016
@driusan driusan merged commit 3fa97ff into aces:17.1-dev Jan 3, 2017
alisterdev pushed a commit to alisterdev/Loris that referenced this pull request Jan 20, 2017
* 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
MounaSafiHarab pushed a commit to MounaSafiHarab/Loris that referenced this pull request Jan 20, 2017
* 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
jstirling91 pushed a commit to jstirling91/Loris that referenced this pull request May 8, 2017
* 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
kongtiaowang pushed a commit to kongtiaowang/Loris that referenced this pull request Jan 31, 2018
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Cleanup PR or issue introducing/requiring at least one clean-up operation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants