Skip to content

[Bug]: TreeView collapses all nodes when changing external state #21001

@Tomahaawk

Description

@Tomahaawk

Package

@carbon/react

Browser

Chrome

Package version

1.94

React version

18

Description

After expanding a few nodes of the TreeView, if I change any state in my application all nodes are collapsed.

I expected the TreeView to keep its state with the expanded nodes.

Reproduction/example

https://stackblitz.com/edit/github-p94ikndd-vgl1vqvr?file=src%2FApp.jsx

Steps to reproduce

Givena TreeView and a button that controls another state in the same page
Expand some of the TreeView nodes.
Click on the Test button to toggle the state.

Expected result: after clicking on the button, the tree view should stay as it is.
Actual result: TreeView collapses all nodes.

Suggested Severity

Severity 3 = User can complete task, and/or has a workaround within the user experience of a given component.

Application/PAL

IBM RPA

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Status

    ⏱ Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions