Skip to content

getGroupedRowModel doesn't calculate leafRows correctly at depth 0 #6093

@stevenwjy

Description

@stevenwjy

TanStack Table version

8.21.3

Framework/Library version

React v19.0

Describe the bug and the steps to reproduce it

See the implementation here:

              // Flatten the leaf rows of the rows in this group
              const leafRows = depth
                ? flattenBy(groupedRows, row => row.subRows)
                : groupedRows

The current implementation only calls the flattenBy function for depth > 0. Meanwhile, I believe the purpose of leafRows is to always create the flattened version and thus the flattenBy must always be called unless groupedRows no longer contains any subrows -- need to check groupedRows.some((row) => row.subRows.length > 0) instead of whether depth is falsy.

Your Minimal, Reproducible Example - (Sandbox Highly Recommended)

Screenshots or Videos (Optional)

No response

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.

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