-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[Table] Should we make TableContext public? #24852
Comments
@jschlieber-innio Imports that are more than one level deep are private. This issue sounds a lot like #23888 that is about accessing |
I would be tempted to close with a "waiting for upvotes" label. It seems to be an advanced usage. |
I would recommend doing this until you find limitations. Then we can discuss how to best solve these limitations. Making something public locks the implementation which increases maintenance burden which affects every user. |
I would really love if TableContext was made public. I have a couple of use cases for it already, were TableContext seems like an obvious solution (mainly just wanted to get the current |
Current Behavior 😯
When importing
import TableContext from "@material-ui/core/Table/TableContext";
and then doinguseContext(TableContext)
within a MaterialUI Table component, e.g.:it seems that the imported TableContext is not equal to the one used to render it's corresponding Provider in the Table component.
I also opened a StackOverflow question related to this because I wanted to see if I missed something obvious: https://stackoverflow.com/questions/66078662/usecontexttablecontext-returns-undefined
Expected Behavior 🤔
From reading the MaterialUI source I would conclude it should be possible to use the TableContext as described in the above example. So this might be some issue with the distribution leading to having multiple non equal TableContexts...
Steps to Reproduce 🕹
https://codesandbox.io/s/quiet-tdd-g2kb4?file=/demo.tsx
Steps:
Context 🔦
I would like to be able to access the TableContext from a deeply nested tree to better align table content to the table size. I'm aware that I could use a custom context to achieve the same, but it just seems kind of odd to not be able to use the already existing TableContext.
Environment 🌎
`npx @material-ui/envinfo`
The text was updated successfully, but these errors were encountered: