diff --git a/src/openforms/submissions/form_logic.py b/src/openforms/submissions/form_logic.py index 1546b4c942..ef22612195 100644 --- a/src/openforms/submissions/form_logic.py +++ b/src/openforms/submissions/form_logic.py @@ -151,7 +151,8 @@ def evaluate_form_logic( data_diff = FormioData() for component in config_wrapper: key = component["key"] - is_visible = config_wrapper.is_visible_in_frontend(key, data_container.data) + # TODO-5139: is_visible_in_frontend must accept a FormioData instance instead + is_visible = config_wrapper.is_visible_in_frontend(key, data_for_evaluation.data) if is_visible: continue diff --git a/src/openforms/submissions/tests/form_logic/test_modify_components.py b/src/openforms/submissions/tests/form_logic/test_modify_components.py index 6b5d24146c..cc452e4949 100644 --- a/src/openforms/submissions/tests/form_logic/test_modify_components.py +++ b/src/openforms/submissions/tests/form_logic/test_modify_components.py @@ -1,3 +1,5 @@ +import unittest + from django.test import TestCase, tag from openforms.forms.constants import LogicActionTypes @@ -874,6 +876,43 @@ def test_component_visible_in_frontend(self): "Some data that must not be cleared!", submission_step.data["textField"] ) + # TODO-5139: this is a bug which currently exists on master as well, and is not + # fixed with the data-structure changes, yet. + @unittest.expectedFailure + def test_component_visible_with_date(self): + form = FormFactory.create() + form_step = FormStepFactory.create( + form=form, + form_definition__configuration={ + "components": [ + { + "key": "date", + "type": "date", + }, + { + "type": "textfield", + "key": "textField", + "hidden": True, + "conditional": {"eq": "2025-01-01", "show": True, "when": "date"}, + "clearOnHide": True, + }, + ] + }, + ) + + submission = SubmissionFactory.create(form=form) + submission_step = SubmissionStepFactory.create( + submission=submission, + form_step=form_step, + data={"date": "2025-01-01", "textField": "Some data that must not be cleared!"}, + ) + + evaluate_form_logic(submission, submission_step, submission.data, dirty=True) + + self.assertEqual( + "Some data that must not be cleared!", submission_step.data["textField"] + ) + @tag("gh-1183") def test_component_incomplete_frontend_logic(self): form = FormFactory.create()