Skip to content

Conversation

TanyaGashtold
Copy link
Contributor

@TanyaGashtold TanyaGashtold commented Apr 1, 2025

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:

  • I have completed the above PR template
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if applicable)
  • My changes generate no new warnings
  • My changes include tests that prove my fix is effective (or that my feature works as intended)
  • New and existing unit/integration tests pass locally with my changes
  • Any dependent changes have corresponding PRs that are listed above

@brendanbond brendanbond merged commit 99251e2 into master Apr 1, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants