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

getIsSomeRowsSelected() does not trigger when all rows are selected #5740

Open
2 tasks done
Serpentarius13 opened this issue Sep 7, 2024 · 0 comments
Open
2 tasks done

Comments

@Serpentarius13
Copy link

Serpentarius13 commented Sep 7, 2024

TanStack Table version

^8.20.5

Framework/Library version

React 18

Describe the bug and the steps to reproduce it

I don't understand why do those handlers exclude each other in implementation. Isn't it the basic rule of logic that when everything is selected, part is deemed selected too? In implementation its not like this by some reason, specifically checking that there shouldn't be every row selected to return true:

table.getIsSomeRowsSelected = () => {
      const totalSelected = Object.keys(
        table.getState().rowSelection ?? {}
      ).length
      return (
        totalSelected > 0 &&
        totalSelected < table.getFilteredRowModel().flatRows.length
      )
}

I think it just causes additional computations if I want to create a global checkbox to select every row. What is the reasoning behind this?

Your Minimal, Reproducible Example - (Sandbox Highly Recommended)

https://stackblitz.com/edit/tanstack-table-y5enqv?file=src%2Fmain.tsx

Screenshots or Videos (Optional)

Image

Do you intend to try to help solve this bug with your own PR?

Yes, I think I know how to fix it and will discuss it in the comments of this issue

Terms & Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
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

No branches or pull requests

1 participant