Leaf rows are not calculated correctly
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 28.4k
- Forks
- 3.6k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 10
Description
TanStack Table version
v8.19.3
Framework/Library version
v.18.0.4
Describe the bug and the steps to reproduce it
Bug exists also in the newest version.
Leaf headers include headers which contain subheaders - it seems inconsistent with a definition of a leaf node.
Quoting https://en.wikipedia.org/wiki/Tree_(graph_theory):
[...] an external vertex (or outer vertex, terminal vertex or leaf) is a vertex of degree 1.
Which means one edge connected. With that logic, only headers with no subheaders should be treated as leaf headers - the only exception is the root header with one subheader.
If this is a design choice, not a feature, I think an understanding of a leaf should be included in the docs, as it is at least confusing.
I'm not opening a PR because I'm not sure if I'm not missing something, but if it turns out to be an issue I'm happy to fix it.
Your Minimal, Reproducible Example - (Sandbox Highly Recommended)
https://codesandbox.io/p/sandbox/h684m4
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked CodeSandbox and reproduce the nested-header case, then trace how leaf headers are calculated in the table code. Confirm whether headers with subheaders are included intentionally; done means either correcting the calculation and covering the behavior with a regression test, or documenting the intended definition of a leaf header.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100