naisutech / react-tree

Hierarchical tree component for React in Typescript
https://naisutech.github.io/react-tree/
MIT License
206 stars 25 forks source link

[BUG] onSelect is being triggered when clicking on any place #55

Closed moatazelsayed121 closed 2 years ago

moatazelsayed121 commented 2 years ago

Hello There are two issues related to using one Tree instance or multiple instances. If we are using for example two Tree instances with onSelect for each one of them Both are triggered on selecting any node in any one of both Trees and that is completely wrong and gets me invalid values.

Note: This error wasn't there before version 2.0.0 and i cannot downgrade because of not supporting typescript.

ortonomy commented 2 years ago

https://stackblitz.com/edit/react-ts-fuzxob

i can't reproduce what you're describing. please reproduce and demo to me and I will re-open and fix.

dontpanic92 commented 2 years ago

@ortonomy The demo you provided exactly reproduced the issue:

react-tree

I'm using Chrome 101 and Firefox 100. It can be reproduced on both browsers.