Closed
Description
In case of conditional visibility, if the parent field of a field comes after it in the schema then the conditional visibility doesn't works.Example:
This works (field 1 is visible)
fields: [
{
component: 'text-field',
name: 'f2',
label: 'Field 2',
initialValue:'a'
},
{
component: 'text-field',
name: 'f1',
label: 'Field 1',
condition: {
when: 'f2',
is: 'a',
},
}
],
This doesn't (field 1 is not visible)
`fields: [
{
component: 'text-field',
name: 'f1',
label: 'Field 1',
condition: {
when: 'f2',
is: 'a',
},
},{
component: 'text-field',
name: 'f2',
label: 'Field 2',
initialValue:'a'
},
],`
One of the solution to this is that we add the subscription for initial along with value here:
<Field name={name} subscription={{ value: true }}>
{({ input: { value } }) => (
<ConditionTriggerDetector
But the react final forms also have a bug due to which the field api doesn't re-renders on change of initial Value. Raised PR(final-form/react-final-form#1034), but there is no response from their end.
Is there any other way to fix this issue?
CC: @Hyperkid123 @rvsia
Metadata
Metadata
Assignees
Labels
No labels