Fixing issue where custom default value without a 'value=' within the script would return an empty string. #6049
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.
Link to Jira Ticket
https://formio.atlassian.net/browse/FIO-XXXX
Description
There was a bug that I fixed in the previous pr ( #6048 ) that was attempting to protect the case where no "value=" is provided within the customDefaultValue as well as the calculatedValue evaluations. Previously, this would return an empty string, which would then set the defaultValue to an empty string causing major problems for incompatible datatypes.
This PR reverts the "fix" from the previous PR and implements a better change which is to default the value passed to the evaluation context with the current dataValue of the component, which is what it should be. This way, if the user does not provide a "value=" within the evaluation, then it will return the current dataValue.
Breaking Changes / Backwards Compatibility
This may break any implementations that previously expected an empty string return as the result of customDefaultValue.
Dependencies
None
How has this PR been tested?
Manual testing
Checklist: