Skip to content

warning: Cannot update a component (ArrayInput) while rendering a different component (SelectInput) #4632

Closed
@panfiva

Description

@panfiva

What you were expecting:
The following code should work without warnings.

<ArrayInput source="tabs" resource={props.resource}
basePath={props.basePath} record={props.record}>
            <SimpleFormIterator labelSource="tabName" basePath={props.basePath} >
              <SelectInput source="template" label="Page tempate"
                choices={[{ id: 'tableau', name: 'Tableau Report' }]}
                initialValue="tableau"
              />
            </SimpleFormIterator>
          </ArrayInput>

What happened instead:
Received warning on chrome console.

Warning: Cannot update a component (`ArrayInput`) while rendering a different component (`SelectInput`). To locate the bad setState() call inside `SelectInput`, follow the stack trace as described in https://fb.me/setstate-in-render
    in SelectInput (at reportEdit.jsx:65)
    in div (created by FormInput)
    in FormInput (created by SimpleFormIterator)
    in section (created by SimpleFormIterator)
    in li (created by SimpleFormIterator)
    in Transition (created by CSSTransition)
    in CSSTransition (created by SimpleFormIterator)
    in TransitionGroup (created by SimpleFormIterator)
    in ul (created by SimpleFormIterator)
    in SimpleFormIterator (at reportEdit.jsx:63)
    in div (created by ForwardRef(FormControl))
    in ForwardRef(FormControl) (created by WithStyles(ForwardRef(FormControl)))
    in WithStyles(ForwardRef(FormControl)) (created by Arr

Steps to reproduce:
Create edit form with ArrayInput -> SimpleFormIterator ->SelectInput and view console log

Related code:
It looks like the issue is with react 16.13.1 and final-form/react-final-form. final-form/react-final-form#751

It appears the issue has been fixed react-final-form to 6.4.0. Please update to use react-final-form 6.4

Environment

  • React-admin version: 3.3.3
  • React version: 16.13.1
  • Browser: Chrome 80.0.3987.122
  • Stack trace (in case of a JS error):

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions