Skip to content
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

All nodes are checked on filter #196

Open
chumarie opened this issue Mar 31, 2020 · 1 comment · Fixed by fedspendingtransparency/usaspending-website#1653 · May be fixed by #217
Open

All nodes are checked on filter #196

chumarie opened this issue Mar 31, 2020 · 1 comment · Fixed by fedspendingtransparency/usaspending-website#1653 · May be fixed by #217
Labels

Comments

@chumarie
Copy link

Describe the bug
Hello, I have got troubles when I filter the nodes with the search bar. All the checkboxes are checked are can't be unchecked, until filterText il cleared

Reproduction steps
Tried with your FilterExample.js

Expected behavior
Any checked checkboxes, excepting if they are presents in checked state

Screenshots
Image from Gyazo

@jakezatecky jakezatecky added the bug label Apr 1, 2020
@javiercaceres
Copy link

javiercaceres commented Apr 15, 2020

Also, leaves are shown as a parent folder after filtering. Part of the problem is here:

isEveryChildChecked(node) {
return node.children.every((child) => this.getNode(child.value).checked);
}

And here:

isEveryChildChecked(node) {
return node.children.every(
(child) => this.state.model.getNode(child.value).checkState === 1,
);
}

.every acts like the "for all" quantifier in mathematics. In particular, for an empty array, it returns true. Leaves with an empty "children" property will be displayed as checked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment