marchaos / react-virtualized-sticky-tree

A React component for efficiently rendering tree like structures with support for position: sticky
MIT License
152 stars 12 forks source link

Fixed issue related to backward and forward both sections getting exe… #29

Closed aggarwal-p closed 3 years ago

aggarwal-p commented 4 years ago

…cuted and eventually cause pos to 0. Repro steps

  1. Render tree with morethan 30K nodes.
  2. Tree component is down deep in other components.
  3. don't enable grouping. as it works fine with grouping.
  4. delete one item from the list.
  5. Make sure to choose another item in scrollIndex.
  6. Repeat this couple of time and at some point setScrollTopAndClosestNode will trigger both forward and backward search section.

Forward search will correctly set the pos but then backward search will reset it back to 0 which will force the sticky tree to start rendering all 30K plus notes and the entire app hangs.

This small check will ensure that if pos is calculated it won't go inside backward search block.