Skip to content

Conversation

@kmcfaul
Copy link
Contributor

@kmcfaul kmcfaul commented Aug 9, 2023

What: Closes #9361

Adds onCollapse callback to TreeView. This callback is triggered when a node that has children is clicked.

Does onCollapse make the most sense for the name, or would onToggle be a better fit?

@patternfly-build
Copy link
Contributor

patternfly-build commented Aug 9, 2023

Copy link
Contributor

@thatblindgeye thatblindgeye left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it's being called when the tree view collapses and expands onToggle sounds like a better fit. Another option might be also adding an onExpand callback and calling it and onCollapse when applicable.

@kmcfaul
Copy link
Contributor Author

kmcfaul commented Aug 15, 2023

Opted to divide the callbacks into onExpand and onCollapse because the opened state of the folder is internal.

Copy link
Contributor

@tlabaj tlabaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think onCollapse make sense.

Can you add some unit test for these please?

@kmcfaul
Copy link
Contributor Author

kmcfaul commented Aug 16, 2023

@tlabaj Just onCollapse or onCollapse + onExpand?

Will add some tests.

Copy link
Contributor

@tlabaj tlabaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@tlabaj tlabaj merged commit 849cd75 into patternfly:main Aug 16, 2023
nicolethoen pushed a commit to Kells512/patternfly-react that referenced this pull request Sep 1, 2023
* feat(TreeView): onCollapse callback

* separate callbacks into collapse and expand

* add test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TreeView - add onCollapse function

4 participants