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

fix(react-table): check empty array in areAllRowsSelected #2527

Merged
merged 1 commit into from Jul 22, 2019

Conversation

@priley86
Copy link
Member

priley86 commented Jul 16, 2019

What:
If an empty array is passed for rows (along with onSelect for the "Selectable table" variation), currently the "all rows selection" checkbox in the top left will be set true b/c rows.every evaluates true with an empty array.

const isSelected = row => row.selected === true; 
let rowsArray = []; 
rowsArray.every(item => isSelected(row));

returns true when called.

Noted this while testing selection downstream today...

Additional issues:

@patternfly-build

This comment has been minimized.

Copy link
Contributor

patternfly-build commented Jul 16, 2019

PatternFly-React preview: https://patternfly-react-pr-2527.surge.sh

@redallen

This comment has been minimized.

Copy link
Contributor

redallen commented Jul 22, 2019

There's probably an isArray() type deal we can use in case we get passed a weird object with a length prop that isn't an array, but this will suffice.

@redallen redallen merged commit 5980944 into patternfly:master Jul 22, 2019
8 checks passed
8 checks passed
ci/circleci: build Your tests passed on CircleCI!
Details
ci/circleci: build_integration Your tests passed on CircleCI!
Details
ci/circleci: build_pf3_docs Your tests passed on CircleCI!
Details
ci/circleci: build_pf4_docs Your tests passed on CircleCI!
Details
ci/circleci: lint Your tests passed on CircleCI!
Details
ci/circleci: test_jest_other Your tests passed on CircleCI!
Details
ci/circleci: test_jest_pf4 Your tests passed on CircleCI!
Details
ci/circleci: upload_docs Your tests passed on CircleCI!
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.