Skip to content

"Cannot update a component while rendering a different component" while using controlled expanded state #6450

Description

@volodymyrdn

TanStack Table version

9.0.0-beta.55

Framework/Library version

React v19.2.6

Describe the bug and the steps to reproduce it

Using the official Expanding example and switching to controlled expanded state, I am receiving an error saying: Cannot update a component (App) while rendering a different component (App).

To switch to the controlled state, these steps were made:

  • const [expanded, setExpanded] = useState<ExpandedState>({}) added to the App.
  • state: { expanded } uncommented.
  • onExpandedChange: setExpanded uncommented.

Here is the link to the sandbox.

Steps to reproduce the error:

  • try to expand any of rows. The error is seen in the console then.

Am I doing it wrong?

Thanks in advance.

Your Minimal, Reproducible Example - (Sandbox Highly Recommended)

https://codesandbox.io/p/devbox/lingering-water-s9qsyv

Screenshots or Videos (Optional)

No response

Do you intend to try to help solve this bug with your own PR?

No, because I do not know how

Terms & Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.

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