Skip to content

Check existence of node during expand/collapse before acting on it #216

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jej2003
Copy link

@jej2003 jej2003 commented Mar 22, 2025

update handling of expanding/collapsing nodes to ensure they exist in the tree

addresses #191

@dgreene1
Copy link
Owner

@mellis481, @yhy-1 do either of you have capacity to review this?

@jej2003 if it doesn’t have unit tests, can you add one?

@jej2003
Copy link
Author

jej2003 commented Mar 22, 2025

@dgreene1 i will look to add one today. Is there a good starting point you could recommend? If not I’ll see if anything exists to base it on

@jej2003
Copy link
Author

jej2003 commented Mar 23, 2025

@dgreene1 , take a look at the updated changes with tests. Any feedback would be appreciated, thanks!

@jej2003
Copy link
Author

jej2003 commented Mar 23, 2025

Philosophically do we want the implementation to be capable of handling data being passed to expandedIds/selectedIds that may not exist in the tree or do we still want to throw in those situations? The changes I implemented and as are demonstrated in the tests make it so that if any ids in expandedIds/selectedIds don't exist the tree will not crash. Conversely, if we want that to still happen then I believe a smaller change is possible. Alternative approach is available at https://github.com/dgreene1/react-accessible-treeview/pull/217/files

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.

2 participants