You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Nested schema and conditionally setting the default field value using resolveProps results in a warning #1249
I have a fairly complex form with nested fields. I use resolveProps to determine the default value. Using formOptions.change() results in a warning as below.
Calling this method using setTimeout does not display the warning.
I know there used to be a similar problem related to React 16 and react-final-form, but I can't find a solution anywhere.
I would expect that using formOptions.change() in resolveProps would not result in a warning.
Using data-driven-forms with resolveProps results in a warning:
Warning: Cannot update a component (`FieldArray`) while rendering a different component (`Radio`). To locate the bad setState() call inside `Radio`, follow the stack trace as described in https://fb.me/setstate-in-render
in Radio (created by SingleField)
in FormFieldHideWrapper (created by SingleField)
in FormConditionWrapper (created by SingleField)
in SingleField (created by ArrayItem)
in ArrayItem (at FieldArrayCustom.tsx:91)
in FieldArray (at FieldArrayCustom.tsx:65)
in FieldArrayCustom (created by SingleField)
in FormFieldHideWrapper (created by SingleField)
in FormConditionWrapper (created by SingleField)
in SingleField (created by ArrayItem)
in ArrayItem (at FieldArrayCustom.tsx:91)
in FieldArray (at FieldArrayCustom.tsx:65)
const setDefaultValue = (form, fieldName) => (value) => {
if (!_.get(form.getState().values, fieldName)) {
// Without setTimeout I get a warning
form.change(fieldName, value)
// With setTimeout everything is ok
setTimeout(() => form.change(fieldName, value), 0)
}
}
Activity