Skip to content

fix: group row ID leaks into rowSelection when selecting grouped rows#1513

Open
VC-Semih wants to merge 2 commits intoKevinVandy:v3from
VC-Semih:fix/header-checkbox-grouping
Open

fix: group row ID leaks into rowSelection when selecting grouped rows#1513
VC-Semih wants to merge 2 commits intoKevinVandy:v3from
VC-Semih:fix/header-checkbox-grouping

Conversation

@VC-Semih
Copy link
Copy Markdown

Fixes #1226

Problem

When grouping is active, selecting a group row (e.g. "gender:Male") causes
its synthetic ID to be written into rowSelection as a side effect of
TanStack's toggleSelected().

Changes

row.utils.ts

  • getMRT_RowSelectionHandler: after row.toggleSelected(), remove the group
    row ID from rowSelection via setRowSelection, leaving only the leaf row
    IDs.

  • getMRT_SelectAllHandler: replace toggleAllPageRowsSelected() /
    toggleAllRowsSelected() with a manual loop over flatRows filtered to
    leaf rows only.

    MRT_SelectCheckbox.tsx

  • Replace getIsAllPageRowsSelected() / getIsAllRowsSelected() and
    getIsSomeRowsSelected() with leaf-only computations with getIsGrouped(),
    as all three native methods include group rows in their denominator.

…hen grouping

TanStack's toggleSelected() on a group row correctly propagates to leaf rows
but also writes the synthetic group row ID (ex: "city:Paris": true) into rowSelection
as a side effect.

After the toggle, removing the group row ID from rowSelection via setRowSelection,
leaving only the leaf row IDs.

Fixes KevinVandy#1226
… when grouping

getIsAllPageRowsSelected(), getIsAllRowsSelected(), and getIsSomeRowsSelected()
include group rows in their denominator, so the header checkbox checked and
indeterminate states couldn't resolve correctly when grouping was active.

Replaced all three with a leaf-only helper that filters flatRows with
getIsGrouped().

Fixes KevinVandy#1226
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 27, 2026

@VC-Semih is attempting to deploy a commit to the Kevin Vandy OSS Team on Vercel.

A member of the Team first needs to authorize it.

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.

Header checkbox does not get selected when selecting page with grouped data

1 participant