FIO-9931: fixed an issue wehre min and max date settings are not saved in builder #6077
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-9931
Description
What changed?
When the min/max date is configured in datetime component settings in builder, the user can choose the mode for the value: calendar picker or just textfield where the user can use moment() function. Before we used two conditional components with the same key that become visible based on the mode. It worked more or less good until the clearOnHide and conditional checks in general were refactored (commits d70fdba#diff-8795d5891ca105e3583ef74383eb1929aeec1fa888d641a0d7be8a91a0abd5f4 and https://github.com/formio/formio.js/pull/6048/files#diff-05d41a5d854049f92f62772ee82f295d614534d5f4f0717b3ec30c69dfc3a7f5). So, when the one component is hidden, it is value is unset, but we have the component with the same key that is visible and it refers to the same value in data object that was unset. So, this is the reason why the value for visible component is lost.
In general, our renderer is not supposed the form to have components with the same key. And the fact, that they worked, is more like an accident. So, this PR changes the min and max date components to use еру merge сomponent schema to change its input type.
How has this PR been tested?
Manually + autotests
Checklist: