Skip to content

Commit

Permalink
Merge pull request #3754 from marmelab/code-enhancement-set-inclusion
Browse files Browse the repository at this point in the history
[RFR] Code enhancement: rewrote list merge (without duplicate) and list inclusion
  • Loading branch information
djhi authored Oct 1, 2019
2 parents 59226f1 + 96fe9d6 commit 0a51e15
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions packages/ra-ui-materialui/src/list/Datagrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,7 @@ function Datagrid({ classes: classesOverride, ...props }) {
event => {
if (event.target.checked) {
onSelect(
ids.reduce(
(idList, id) =>
idList.includes(id) ? idList : idList.concat(id),

selectedIds
)
ids.concat(selectedIds.filter(id => !ids.includes(id)))
);
} else {
onSelect([]);
Expand Down Expand Up @@ -206,9 +201,7 @@ function Datagrid({ classes: classesOverride, ...props }) {
checked={
selectedIds.length > 0 &&
ids.length > 0 &&
!ids.find(
it => selectedIds.indexOf(it) === -1
)
ids.every(id => selectedIds.includes(id))
}
onChange={handleSelectAll}
/>
Expand Down

0 comments on commit 0a51e15

Please sign in to comment.