primereact icon indicating copy to clipboard operation
primereact copied to clipboard

Tree: Bad initialization of expanded keys when filter option is present

Open RolT opened this issue 1 month ago • 1 comments

Describe the bug

The initial value given to expandedKeys gets overridden if a filter field is present, even if the filter value is empty.

In the reproducer, both trees use the same initial expandedKeys but the tree with the filter field is not initialized properly (all nodes are collapsed).

Image

Reproducer

https://stackblitz.com/edit/edubbxcg

System Information

primereact: 10.9.7

Steps to reproduce the behavior

No response

Expected behavior

Both trees should be the same upon first render.

RolT avatar Nov 26 '25 14:11 RolT

It's not just about initialization, when changing the model all the nodes are collapsed if the filter is empty:

https://stackblitz.com/edit/edubbxcg-bpppr4jy

  1. Expand a node
  2. Click on 'Add item'
  3. All the nodes are collapsed

RolT avatar Nov 27 '25 09:11 RolT

Thanks @RolT for posting this - I have the same issue.

domhaas avatar Dec 15 '25 17:12 domhaas