Skip to content

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

Closed

Description

@Serpentarius13

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.

Activity

  1. karlshea commented on Aug 7, 2025

    @karlshea

    I ran into the same issue today and I'm not sure this is a bug. We're using getIsSomeRowsSelected() to set indeterminate on a checkbox, and getIsAllRowsSelected() to set checked.

    The documentation around it may need updating though.

  2. ackvf commented on Dec 30, 2025

    @ackvf

    @karlshea This is indeed wrong, there is no room for different interpretation. Consider this well known JS feature:

    [true, true, false].some(b => b===true) // true
    [true, true, false].every(b => b===true) // false
    
    [true, true, true].some(b => b===true) // true
    [true, true, true].every(b => b===true) // true
    

    In logic and set theory EVERY (or ALL) implies SOME and therefore they cannot redefine the meaning of it even if the motivation is convenience. This is just more overhead for the developer.

    However, I understand that there is a need for different state variables to represent what you describe.

    AND that the documentation absolutely needs updating.

    Anyway, fixing it now without breaking anything would be probably catastrophic, so at least a documentation change is necessary, but ideally a migration strategy in future versions would be great too.

  3. KevinVandy commented on Jul 27, 2026

    @KevinVandy
    Member

    thankfully fixed this in v9. This was one of the v8 design decisions I personally disagreed with too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions