Remove status from Form state (BUG FIX) #660
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Reasons for making this change
This fixes a bug that causes the error list to flicker when formData is edited.
To reproduce: go to the "Errors" tab on the playground, select an input on the Form and start smashing the keyboard (you don't really even have to smash the keyboard, you can see the effect on any single form data change). The error list will flicker.
First I thought the bug was caused by some recent commits regarding the Error List, but actually the flickering is caused by the
status
state property, which will flip betweeninitial
andediting
during typing.The
status
property has been there from the very first commit, but I can't find any real use for it other than causing this bug. I don't understand why we wouldn't show the error list when the Form is edited. Even if there was some kind of buffering that would hide the error list only when the formData is updated in intervals less time than some milliseconds, it would affect the page scrolling position before and after the user stops typing. The only side effect that removingstatus
causes that I can think of is that whenonSubmit
callsthis.props.onSubmit(this.state)
, thestate
won't containstatus: "submitted"
- which seems kind of pointless to me :)Checklist
npm run cs-format
on my branch to conform my code to prettier coding style