Unable to subscribe to table.options.meta #6236
Send to my agentTanStack Table version#
v9.0.0-alpha.32
Framework/Library version#
React v19.2.5
Describe the bug and the steps to reproduce it#
The table.Subscribe component does not provide a way to subscribe to meta changes. This causes children to become stale.
In the reproducible example, a state is directly attached to the meta of the table. Even though the selector provided to table.Subscribe is the most flexible possible, the value of table.options.meta does not change in the child component.
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?#
No, because I do not have time to dig into it
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.
Thanks Kevin for the quick answer 😉 I'll try this out today. This seems promising!
Using
useSelector(table.optionsStore, (options) => options.meta)seems to work as expected.I was going to say that it is unfortunate that a parent rerender is not propagate through
table.Subscribe, which would be the expected behaviour with React, but I realized that there is probably someReact.memoinvolved in that HOC.kevinpastor(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
Before I even saw this issue, the new alpha I shipped today apparently made this possible like this:
Although, I'm probably going to now rename
atomtosourcesince it works for both atoms and stores.So this should work soon:
You can also just use a
useSelector(formerlyuseStore) hook imported from@tanstack/react-storefor any tanstack store/atom to make it reactive where you need it.