Skip to content

[v8] Row selection with sub rows has parent propagation issues #4298

Closed

Description

@dudel

Describe the bug

When selecting sub rows there are some parent selection propagation issues:

  1. When selecting a sub row with depth 3 then the parent is selected as indeterminate but the parent's parent is not selected
  2. When selecting all sub rows (depth 3) of a certain parent then the parent selection changes from indeterminate to not selected instead of selected and the top-level parent is still marked as not selected

Your minimal, reproducible example

https://codesandbox.io/s/github/tanstack/table/tree/main/examples/react/expanding?from-embed

Steps to reproduce

In the codesandbox (official react-table row expansion example):

  • Expand any top-level row and any child of the expanded top-level row
  • For issue 1): Select any leaf row with depth 3 --> Parent marked as indeterminate and the parent's parent still marked as not selected
  • For issue 2): Select all leaf rows with depth 3 --> Parent changes from indeterminate to not selected and the parent's parent is still marked as not selected

Expected behavior

As a user, I expected

  • for 1) that the direct and indirect parent rows of the leaf row that was marked as selected are marked as indeterminate (or selected depending on the data)
  • for 2) that the direct and indirect parent rows of the leaf rows that were marked as selected are marked as selected
    but I am seeing that
  • for 1) the direct parent is marked as indeterminate but the indirect parent is marked as not selected
  • for 2) the direct and indirect parents are marked as selected

How often does this bug happen?

Every time

Screenshots or Videos

For 1)
image

For 2)
image

Platform

  • OS: Windows
  • Browser: Chrome (104), but also Firefox and Edge

react-table version

8.5.11

TypeScript version

4.7.4

Additional context

No response

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. KevinVandy commented on Jul 1, 2026

    @KevinVandy
    Member

    Looking at this now, the library is working as expected, but for the behavior you want, you just need code like this:

    checked={
      row.getIsSelected() ||
      (row.getCanSelectSubRows() && row.getIsAllSubRowsSelected())
    }
    indeterminate={row.getIsSomeSelected()}
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