Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling row.getParentRow() with expanded, filtered row models and initial filtering value throws an error #5630

Open
2 tasks done
Gascon1 opened this issue Jun 28, 2024 · 1 comment

Comments

@Gascon1
Copy link

Gascon1 commented Jun 28, 2024

TanStack Table version

v8.17.3

Framework/Library version

v18.3.0

Describe the bug and the steps to reproduce it

Calling row.getParentRow() inside a custom filter function for a given column throws an error (Cannot read properties of undefined (reading 'rows')) when using the expanded and filter row models.

I faced this issue when using a custom filter function that filters by both parent and child rows, allowing for multiple levels of nesting in the data staying visible if at least one item in the "family" matches the filter.

This issue does not happen when the initial filter value is empty, only when there's a defined initial filter value (see sandbox).

After hours of investigating I hit a dead end. From what I can see, one of the row models in the waterfall of row models called through filtering is unexpectedly returning undefined, but I couldn't make sense of why. My hunch is that it's the getPreSortedRowModel() call that causes the issue, but I've seen it fail at other row model calls as well.

Your Minimal, Reproducible Example - (Sandbox Highly Recommended)

https://codesandbox.io/p/devbox/tanstack-table-initial-filtering-error-qwf43v?file=%2Fsrc%2Fmain.tsx%3A121%2C48

Screenshots or Videos (Optional)

No response

Do you intend to try to help solve this bug with your own PR?

Maybe, I'll investigate and start debugging

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.
@etiennecoyacabelio
Copy link

Any updates ? i'm facing the same issue

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

No branches or pull requests

2 participants