FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(react-table): check empty array in areAllRowsSelected by priley86 · Pull Request #2527 · patternfly/patternfly-react · GitHub

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

Merged
redallen merged 1 commit into
patternfly:masterfrom
priley86:table-allselected-fix
Jul 22, 2019
Merged

fix(react-table): check empty array in areAllRowsSelected#2527
redallen merged 1 commit into
patternfly:masterfrom
priley86:table-allselected-fix

Conversation

priley86 commented Jul 16, 2019
edited
Loading

Copy link
Copy Markdown
Member

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:

Copy link
Copy Markdown
Collaborator

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

Copy link
Copy Markdown
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 merged commit 5980944 into patternfly:master Jul 22, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL