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 select all over multiple pages #6950

Merged
merged 2 commits into from
Dec 7, 2021
Merged

Fix select all over multiple pages #6950

merged 2 commits into from
Dec 7, 2021

Conversation

WiXSL
Copy link
Contributor

@WiXSL WiXSL commented Dec 6, 2021

Fixes #6943

@vercel
Copy link

vercel bot commented Dec 6, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployments, click below or on the icon next to each commit.

react-admin – ./examples/simple

🔍 Inspect: https://vercel.com/marmelab/react-admin/A2d1bMhyo4Q3sZNJVeWqct4sMpUm
✅ Preview: https://react-admin-git-fix-selectall-marmelab.vercel.app

react-admin-storybook – ./

🔍 Inspect: https://vercel.com/marmelab/react-admin-storybook/6SaRUgBms3hXVRDDFxwWVXdvuv5B
✅ Preview: Failed

[Deployment for 6743f8a failed]

@basukb
Copy link

basukb commented Dec 7, 2021

@WiXSL the fix looks good . https://react-admin-git-fix-selectall-marmelab.vercel.app is working now

Copy link

@basukb basukb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@fzaninotto fzaninotto left a 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.

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]
);

@fzaninotto fzaninotto merged commit 51640ba into master Dec 7, 2021
@fzaninotto fzaninotto deleted the fix-selectall branch December 7, 2021 12:33
@fzaninotto fzaninotto added this to the 3.19.3 milestone Dec 7, 2021
@basukb
Copy link

basukb commented Dec 7, 2021

May I know when this fix will be released ?

@WiXSL
Copy link
Contributor Author

WiXSL commented Dec 7, 2021

Is set in the next milestone
Should be pretty soon

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.

SelectAll works only in 1st page and doesn't work in other pages
3 participants