I have created a control using the following uiSchema
{
scope: '#/properties/is_there_a_loan_on_this_property',
type: 'Control',
options: {
format: 'radio'
}
},
{
scope: '#/properties/navigation_loans',
type: 'Control',
rule: {
effect: 'SHOW',
condition: {
scope:
'#/properties/is_there_a_loan_on_this_property',
schema: {
enum: ['Yes']
}
}
}
}
In navigation_loans control I check for the visibility of the control and apply default data
to it if it’s not visible.
useEffect(() => {
setTimeout(() => {
if (visible && !data) {
const defaultData = {
isEnabled: true,
isRequired: true,
isCompleted: false
}
handleChange(path, defaultData)
}
if (!visible) {
const defaultData = {
isEnabled: false,
isRequired: false,
isCompleted: true
}
handleChange(path, defaultData)
}
}, 0)
}, [visible, data])
My problem is I don’t have a way to identify if the control is hidden due to the rule condition being met or if the form is being unloaded. I don’t want to update the navigation_loans value if the form is unloaded.