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 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:

@priley86 priley86 added bug 🐛 PF4 React issues for the PF4 core effort labels Jul 16, 2019
@patternfly-build
Copy link
Contributor

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

@redallen
Copy link
Contributor

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PF4 React issues for the PF4 core effort
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants