Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 [#5104] Solving default value being set to 'null'
The `FormioUtils.fastCloneDeep(component)` makes a new instance of the component (with a new unique id). For the most part this is okay, but when the `defaultValue` is set to a falsey value (like an empty string), the `defaultValue` from `FormioUtils.fastCloneDeep(component)` will be `null`. For the bug #4659 this was solved by manually correcting the default value of textfield and email components from `null` to `''`. This corrected the problem for these components (and ensured that these components always have a valid default value), but didn't solve the problem for other components. By merging `original` and `FormioUtils.fastCloneDeep(component)` into one object, we retain the original component configuration and give the `componentCopy` a unique id. The id must be unique for proper cancelation functionality (if the id of `componentCopy` is the same as the original, an error will be thrown when you edit the component > cancel editing > edit it again)
- Loading branch information