Refactor stringifyFormReplacer
helper function into more modular functions
#259
Labels
[practice] engineering
Engineering related work
[type] debt
Tech debt, refactors, maintenance issues
Milestone
Is your feature request related to a problem? Please describe.
The
transformForSubmit
helper function defaults to use thestringifyFormReplacer
when processing form data for submission. The processing instringifyFormReplacer
performs a lot of magic and could likely have unintended side effects. This actually did happen while adding a new feature in vets.gov. This line in particular was responsible for stripping out a valid address object, leading to a lot of confusion when trying to figure out why the correct payload wasn't getting sent to the backend service.Describe the solution you'd like
Perhaps the functionality in
stringifyFormReplacer
could be broken out into smaller parts andtransformForSubmit
could opt in to only the processing the user wanted. That's just a suggestion.Additional context
I chatted with @annekainicUSDS about this on September 10, 2018. She determined that this particular code has been in use for a long time and is likely a relic from the original HCA on Vets.gov. It's possible that forms actually depend on this JSON transformation, so any solution would have to avoid breaking forms that are calling this function.
The text was updated successfully, but these errors were encountered: