Skip to content

Tree expand/collapse API does not work from setTimeout callback #16212

Open
@arikkfir

Description

@arikkfir

Reproduction

StackBlitz reproduction

Steps to reproduce:

  1. Click the "Open Bottom Sheet" button
  2. Tree nodes in the bottom sheet are not expanded, despite a call to treeControl.expandAll() inside a setTimeout callback

Proof that the setTimeout is somehow causing this, is that if you comment out the call to window.setTimeout(() => this.treeControl.expandAll(), 3000) (line 54) and uncomment the simpler this.treeControl.expandAll(); call (line 57) it does work.

Expected Behavior

Bottom sheet should open with all tree nodes expanded, due to the call to treeControl.expandAll() call.

Actual Behavior

Tree nodes are all collapsed, despite a the call to treeControl.expandAll() call.

Environment

  • Angular: 8.0.0
  • CDK/Material: 8.0.0
  • Browser(s): Google Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): MacOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4A relatively minor issue that is not relevant to core functionsarea: material/tree

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions