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

TypeError: Cannot read property 'dense' of undefined #13716

Closed
Ak-lee opened this issue Nov 28, 2018 · 7 comments
Closed

TypeError: Cannot read property 'dense' of undefined #13716

Ak-lee opened this issue Nov 28, 2018 · 7 comments
Labels
component: list This is the name of the generic UI component, not the React module!

Comments

@Ak-lee
Copy link

Ak-lee commented Nov 28, 2018

when I use the material-ui in client side ,there is no problem, but when i use the material-ui's server rendering, once I use the <ListItem> component , there is a error:
TypeError: Cannot read property 'dense' of undefined
the total info:
Warning: Rendering <Context.Consumer.Provider> is not supported and will be removed in a future major release. Did you mean to render <Context.Provider> instead?
Warning: Rendering <Context.Consumer.Consumer> is not supported and will be removed in a future major release. Did you mean to render <Context.Consumer> instead?
TypeError: Cannot read property 'dense' of undefined
at Object.eval [as children] (webpack:///./node_modules/@material-ui/core/ListItem/MergeListContext.js?:28:38)
at recursive (C:\Users\Administrator\Desktop\webpack-demo\node_modules\react-tree-walker\dist\react-tree-walker.js:129:41)
at C:\Users\Administrator\Desktop\webpack-demo\node_modules\react-tree-walker\dist\react-tree-walker.js:153:26

The server rendering config almost same as the official website,at present, the server work out only when I use the <ListItem> component.

Your Environment 🌎

Tech Version
Material-UI v3.5.1
React 16.6.0
Browser chrome
Node 10.13.0
etc.
@eps1lon eps1lon added bug 🐛 Something doesn't work component: list This is the name of the generic UI component, not the React module! labels Nov 28, 2018
@eps1lon
Copy link
Member

eps1lon commented Nov 28, 2018

That's weird. It seemed like this was working with the legacy context API #13498.

I need to investigate why support for this was dropped and how this effects the List component.

@eps1lon
Copy link
Member

eps1lon commented Nov 28, 2018

Upon further investigation it does seem like an issue with react-tree-walker. It does not log any warnings with a simple Provider > Consumer > Provider > Consumer nesting: https://codesandbox.io/s/5v64rlwn7x

Could you provide a minimal reproducible example?

@eps1lon eps1lon added waiting for user information and removed bug 🐛 Something doesn't work labels Nov 28, 2018
@oliviertassinari
Copy link
Member

oliviertassinari commented Nov 28, 2018

I remember @gaearon warning about using react-tree-walker on Twitter. Also, it seems they are working on adding support for the new context API. I would suggest we close this issue as won't fix.

@oliviertassinari
Copy link
Member

oliviertassinari commented Nov 28, 2018

@Ak-lee Wait for the next release of react-tree-walker, it should be gone. In the meantime, you can rollback to Material-UI v3.3.0, before we have stoped using the deprecated context API.

@Ak-lee
Copy link
Author

Ak-lee commented Nov 29, 2018

I find the error only throw out in a particular case.
https://github.com/Ak-lee/webpack-server-render-debug
Enter the folder, then npm run dev:client , open a new cmd window, then npm run dev:server , open the browser at http://localhost:3333, then the error throw out.
I am run the npm run dev:client and npm run dev:server for the automatic server side rendering when develop the project. once the code change, the server side render will be reexecution.
the error only throw out in this case.
when i run npm run dev:client and open browser at http://localhost:8888, or run npm run build and npm start and open the browser at http://localhost:3333 , the error will not threw out.
I am sorry that I have't simplify the project , because this error only throw out in this particular case
@eps1lon @oliviertassinari

@vdfdev
Copy link

vdfdev commented Feb 18, 2019

I can confirm that downgrading to 3.3.0 works, but still getting this error when using the latest version.
I will try to setup a minimal example.

@joshwooding
Copy link
Member

@flamecoals Do you have a minimal reproducible example?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: list This is the name of the generic UI component, not the React module!
Projects
None yet
Development

No branches or pull requests

5 participants