Skip to content

[Tree View]: api.collapse throws error #2529

Closed
@NGimbal

Description

@NGimbal

πŸ› Bug report

Calling api.collapse() causes an error to be thrown.

πŸ’₯ Steps to reproduce

  1. Go to the tree view component
  2. Click on Collapse All
  3. See error

πŸ’» Link to reproduction

This bug is reproducible in production

https://zagjs.com/components/react/tree-view
https://stackblitz.com/run?file=src%2FApp.tsx,src%2FTreeView.tsx&showSidebar=0

🧐 Expected behavior

If no nodes are expanded nothing should happen. If any nodes are expanded all should be collapsed.

🧭 Possible Solution

Looks like the error is thrown here:

const expandedValue = Array.from(context.get("expandedValue"))

And may be related to:
#2512

🌍 System information

Software Version(s)
Zag Version 1.15.7
Browser Chrome
Operating System MacOS 15.5

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