Tanstack v9 still doesn't really support react compiler
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
9.1.2
Framework/Library version
React 19.2.8
Describe the bug and the steps to reproduce it
Tanstack table uses internally mutable state, something that goes against Reacts immutability assumptions. This creates issues with the react compiler. v9 tries to make it work with the compiler by making the table object a non stable object. This happens to work out in many cases, not because it now follows the rules of react but because exactly how the compiler currently reason about those rules often shake out that way. Depending on internal implementation details like this and advocating for your users to leave the compiler on for components using tanstack table seem irresponsible as a future version of the compiler could suddenly break your users apps.
The attached stackblitz shows how sending a value to a completely unrelated hook can cause react compiler to make different decisions, breaking something that previously worked out. To me this demonstrates that what tanstack table is doing is still fundamentally breaking the react compilers rules and could break at any time.
This is causing issues with Octane as well as it wants to rely on similar assumptions as the react compiler for its optimizations. That is probably not your issue to solve but mentioning it as well as it was through investigating weird decisions around memoization in Octane that I discovered this issue. https://github.com/octanejs/octane/issues/846#issuecomment-5432084415
Your Minimal, Reproducible Example - (Sandbox Highly Recommended)
https://stackblitz.com/edit/vitejs-vite-deapj37r?file=src%2FApp.tsx
Screenshots or Videos (Optional)
No response
Do you intend to try to help solve this bug with your own PR?
None
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 StackBlitz reproduction, especially src/App.tsx, using React 19.2.8 and TanStack Table 9.1.2. Confirm how adding an unrelated hook changes React Compiler behavior, then define and validate a compiler-safe table behavior whose result is not dependent on that unrelated change.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100