jakezatecky / react-checkbox-tree

A simple and elegant checkbox tree for React.
https://jakezatecky.github.io/react-checkbox-tree/
MIT License
709 stars 211 forks source link

checking an item with a filter will clear any items that are not visible #289

Open ldeveber opened 3 years ago

ldeveber commented 3 years ago

Describe the bug Please include a clear and concise description of what the bug is.

With an implementation similar to: https://github.com/jakezatecky/react-checkbox-tree/blob/master/examples/src/js/FilterExample.js

Select a bunch of nodes, and then search and check one. The selection gets cleared to whats visible.

I guess the second issue is the demo I copy pasted doesn't totally work either as leafs suddenly show as parents when searching:

Screen Shot 2021-07-07 at 11 39 16 AM Screen Shot 2021-07-07 at 11 38 50 AM

Reproduction steps Please include the necessary steps to reproduce the issue as well as a live example that showcases it. You can modify this CodeSandbox reference point to create a working example.

https://codesandbox.io/embed/react-checkbox-tree-example-forked-jh73o?fontsize=14&hidenavigation=1&theme=dark

1) select a bunch of nodes 2) search for something 3) select something

EXPECTED: the node from step 3 should be added to the collection of selected nodes from step 1

ACTUAL: only the nodes visible from the search on step 2 are selected

Expected behavior Please include a clear and concise description of what you expected to happen.

nodes that were selected before searching should remain selected

Screenshots If applicable, add screenshots to help explain your problem.

ACTUAL BEHAVIOR: nodes get cleared on search

jakezatecky commented 3 years ago

Thanks for the report.

ldeveber commented 3 years ago

I forgot to mention this broke on upgrading from 1.6 to 1.7.1! I did not try 1.7.0.

ItayBa commented 2 years ago

happens to me too . The problem seem to be happening on the onCheck callback on a filtered tree. The component remembers the last checked state (filter and unfilter without checking will show you that) , but onCheck callback will not return the filtered tree state .

anmohanty123 commented 2 years ago

@jakezatecky any update on this?

zhr1130 commented 2 years ago

@jakezatecky , would you take a look at this bug please ? We are currently blocked from using 1.7 and up version :(

jakezatecky commented 2 years ago

I have been knocking out issues on another project with my limited time, but I intend to shift gears back to this component soon.

sandeep-07 commented 11 months ago

@jakezatecky any update on this issue . We are using this component in our production environement and occuring loss of time

zhangjianrencai commented 1 month ago

@sandeep-07 did you resolve this issue? I met the same issue