Skip to content

parentId or getParentRow is undefined for grouped data (flat data + grouping column) #4881

@csantos1113

Description

@csantos1113

Describe the bug

parentId and getParentRow returns undefined for leafRows that are grouped by a given column

Your minimal, reproducible example

https://codesandbox.io/s/row-grouping-forked-pg5nco

Steps to reproduce

  1. Go to https://codesandbox.io/s/row-grouping-forked-pg5nco
  2. Expand/Collapse the "single" status
  3. Notice the parentId is undefined and the getParentRow in the console is undefined too

Expected behavior

I expected the parentId to reference the "virtual" aggregatedGroupedRow tanstack table creates internally.

How often does this bug happen?

Every time

Screenshots or Videos

Screenshot 2023-05-26 at 11 19 05 AM

Platform

  • OS: all
  • Browser: all

react-table version

v8.9.1

TypeScript version

N/A

Additional context

I think because tanstack table is creating a "virtual/fake" row for the grouping, that row id should be assigned to its subRows so we don't lose its parenting references

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