[feature]not removing field name from state, when its value become empty
See original GitHub issueIn all examples if write something in input, than clear it, the field name will be dropped from state. But is it possibly maybe with some additional prop like notRemoveWhenEmpty
in Field, the value will be null, or empty or anything else.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:42
- Comments:24 (4 by maintainers)
Top Results From Across the Web
state is cleared, but input field text is not after form is submitted ...
I've managed to clear the state once the form is submitted with 'this.setState({newTodo: ''})' (indicated by hitting submit again will add an ...
Read more >Troubleshooting for RDS Proxy - AWS Documentation
A State value of UNAVAILABLE indicates a temporary or permanent connection problem. In this case, examine the Reason and Description fields.
Read more >APPENDIX D: VALUATION PROTOCOL - HUD
APPENDIX D: VALUATION PROTOCOL. The appraisal process is the lender's tool for determining if a property meets the minimum requirements.
Read more >filebeat.reference.yml - Elastic
If left empty, # Filebeat will choose the paths depending on your OS. ... #clean_inactive: 0 # Removes the state for file which...
Read more >Excel spill range explained - Ablebits
Spill range refers to an array of values returned by a dynamic array ... To remove all values in the spilt area, delete...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
In the meantime, I’ve wrote a simple adapter for the Field component, and my application code imports this adapter component in place of the official one:
The fact that parse, by default, isn’t an identity function (e.g.,
value => (value)
) is not what I would expect. @erikras, thoughts?I can speak to my use case (maybe it applies to others-- I am migrating from redux-form, but I don’t want to sound like a special snowflake, either). I have an existing record I am editing via HTTP PATCH. The field in question cannot be null – this is enforced at the database level. If a user clears the field, it will be null, and thus its key will be set to
undefined
in the onSubmit function. (Analogously, I believe it would have been an empty string in redux-form).By the time the object makes it to my ORM and ultimately becomes a SQL statement, the deleted property isn’t included in the UPDATE sql statement. So the HTTP PATCH request successfully executes. The user then assumes the request is valid, but if they refresh the page, they would see the value they attempted to delete is still there. The fact that the user had entered an empty string in the text input was valuable – I used that to throw an error.
Again, this might be my personal super snowflake use case, but I’m curious if it’s something others have encountered. Maybe this is more of an issue with my ORM neglecting to attempt passing the undefined value.