react-forms icon indicating copy to clipboard operation
react-forms copied to clipboard

How to re-execute conditions ad-hoc?

Open Hyperkid123 opened this issue 2 months ago • 0 comments

Discussed in https://github.com/data-driven-forms/react-forms/discussions/1520

Originally posted by malloy045 November 4, 2025 TLDR: Is there a way to get conditions to re-execute on an ad-hoc basis?

Details:

We have schemas that contain conditions like this:

"condition": {
    "when": "field1",
    "is": "foo",
    "then": {
        "visible": false, 
        "set": 
        { 
            "field2": null
        }
    },
    "else": {
        "visible": true
    }
}

We also need to periodically refresh the forms to make sure the latest data is being displayed to the user. That is being done through a call to restart(). We are noticing that when we call restart(), the conditions on the fields are not being executed.

This makes sense since restart() is a final form construct, but is there anything within the DDF framework that we can leverage to also re-execute things like conditions?

In the example above, we are expecting to see field2 set to null and it is not.

Thanks.

Hyperkid123 avatar Nov 07 '25 10:11 Hyperkid123