Skip to content

Mat-Tree: Adding a child to an existing node does not automatically update the UI #11984

@Craig939393

Description

@Craig939393

Bug, feature request, or proposal:

Bug

What is the expected behavior?

adding a new child to an existing node on the data source updates view with new child

What is the current behavior?

view is not updated

What are the steps to reproduce?

  1. get a node that is on the tree (I made a flatten tree function to easily reference any node in the tree)
  2. push a new child into that nodes children

What is the use-case or motivation for changing an existing behavior?

the UI state is not in sync with the data source

Is there anything else we should know?

There is a workaround in that you can set the data source data to null and then set it again which correctly updates the UI. ie

const data = this.nestedDataSource.data;
this.nestedDataSource.data = null;
this.nestedDataSource.data = data;

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