dgreene1 / react-accessible-treeview

A react component that implements the treeview pattern as described by the WAI-ARIA Authoring Practices.
https://dgreene1.github.io/react-accessible-treeview
MIT License
277 stars 37 forks source link

Fix a bug with node deletion #132

Closed mihna123 closed 1 year ago

mihna123 commented 1 year ago

What does this PR do?

It fixes a bug with node deletion. The bug happens when you send data with some nodes missing (because you deleted them) to TreeView component, and you want to have all nodes expanded with expandedId prop. This small fix just checks if node is still in the tree before trying to collapse it, otherwise the exception "Node with id=x doesn't exist in the tree" will be thrown.

dgreene1 commented 1 year ago

@mihna123 we need to have an issue that explains the defect before we get a PR.

Also, we can’t merge code that doesn’t have a unit test. If there is a bug, we’ll need to make sure that the unit test fails when your code is missing and passes once your fix is present.

mihna123 commented 1 year ago

@mihna123 we need to have an issue that explains the defect before we get a PR.

Also, we can’t merge code that doesn’t have a unit test. If there is a bug, we’ll need to make sure that the unit test fails when your code is missing and passes once your fix is present.

Sorry, i will make an issue then

mihna123 commented 1 year ago

@dgreene1 here is the issue #133

callwait commented 1 year ago

I faced this issue as well, can you merge it?

dgreene1 commented 1 year ago

@mihna123 this PR lacks unit tests. In order for us to know that the bug is fixed, we need a unit test. This will also ensure that it does not regress in the future, as long as the test fails when your fix is removed and passes when your fix is present.

cc @callwait

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 1 year ago

This issue was closed automatically since it was marked as stale because it has not had recent activity. Thank you for your contributions.