-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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 select all over multiple pages #6950
Conversation
This pull request is being automatically deployed with Vercel (learn more). react-admin – ./examples/simple🔍 Inspect: https://vercel.com/marmelab/react-admin/A2d1bMhyo4Q3sZNJVeWqct4sMpUm react-admin-storybook – ./🔍 Inspect: https://vercel.com/marmelab/react-admin-storybook/6SaRUgBms3hXVRDDFxwWVXdvuv5B [Deployment for 6743f8a failed] |
@WiXSL the fix looks good . https://react-admin-git-fix-selectall-marmelab.vercel.app is working now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good . Tested in https://react-admin-git-fix-selectall-marmelab.vercel.app
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This solves the problem, but I think the code isn't clear. Why should a row be selected if there is no data?
Take a look at the refactoring I made to the same file in useGetList
for a better version of the fix.
react-admin/packages/ra-ui-materialui/src/list/datagrid/DatagridHeader.tsx
Lines 59 to 78 in 1f52ce5
const handleSelectAll = useCallback( | |
event => | |
onSelect( | |
event.target.checked | |
? selectedIds.concat( | |
data | |
.filter( | |
record => !selectedIds.includes(record.id) | |
) | |
.filter(record => | |
isRowSelectable | |
? isRowSelectable(record) | |
: true | |
) | |
.map(record => record.id) | |
) | |
: [] | |
), | |
[data, onSelect, isRowSelectable, selectedIds] | |
); |
May I know when this fix will be released ? |
Is set in the next milestone |
Fixes #6943