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

Issue with react-tree-walker #14846

Closed
chnliquan opened this issue Mar 11, 2019 · 9 comments
Closed

Issue with react-tree-walker #14846

chnliquan opened this issue Mar 11, 2019 · 9 comments
Labels
external dependency Blocked by external dependency, we can’t do anything about it

Comments

@chnliquan
Copy link

i use material-ui + react-async-bootstrapper
implement react ssr, In the development environment, using react ssr to report an error, the production environment is normal

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?:27:31)
    at recursive (/Users/ender/learning/github/react-cnode/node_modules/react-tree-walker/dist/react-tree-walker.js:129:41)
    at /Users/ender/learning/github/react-cnode/node_modules/react-tree-walker/dist/react-tree-walker.js:153:26
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)

Your Environment 🌎

Tech Version
Material-UI v3.9.2
React v16.8.3
Browser chrome
react-async-bootstrapper v2.1.1
@chnliquan
Copy link
Author

I found that deleting the import List from '@material-ui/core/List' component will not give an error.

@joshwooding
Copy link
Member

@chnliquan Do you have a minimal reproducible example?

@joshwooding joshwooding added the status: waiting for author Issue with insufficient information label Mar 11, 2019
@chnliquan
Copy link
Author

@joshwooding https://github.com/chnliquan/react-cnode
This problem occurs in development mode. This problem does not occur after I delete the List component. The production environment will not go wrong whether or not it contains a List component.

@oliviertassinari oliviertassinari added external dependency Blocked by external dependency, we can’t do anything about it and removed status: waiting for author Issue with insufficient information labels Mar 12, 2019
@oliviertassinari
Copy link
Member

oliviertassinari commented Mar 12, 2019

@chnliquan You are using the react-tree-walker dependency. They don't support the new context API: ctrlplusb/react-tree-walker#47. But more importantly, it's only advised for advanced users that know what they are doing: https://github.com/ctrlplusb/react-tree-walker#disclaimer. Since you are opening an issue on Material-UI side, I would guess that you are only interested in something that works. So I would advise you to remove this dependency.

We have no leverage over this external dependency limitation. I'm closing.

@oliviertassinari oliviertassinari changed the title Type error in ssr development mode Issue with react-tree-walker Mar 12, 2019
@chnliquan
Copy link
Author

@oliviertassinari this problem only exists with the development environment, the production environment is no problem, If there is a problem, the behavior of the development environment and the production environment should be the same?

@chnliquan
Copy link
Author

I do react ssr need to use this package for data synchronization. If you suggest me to remove, are there any other solution suggestions?

@oliviertassinari
Copy link
Member

oliviertassinari commented Mar 12, 2019

@chnliquan react-tree-walker dependency is likely legacy, they don't support the context, probably not the hooks either 🤔. Have you tried Next.js? Apollo was using a strategy closed to react-tree-walker, they have stopped doing it for this very problem. They are now rendering the tree x times until they reach all the leaves. It has a huge performance implication. Next.js solves the problem by co-locating all the data fetching at the root. React is working on a solution in the core of the library.

@chnliquan
Copy link
Author

@oliviertassinari Thank you for your reply 😄, If I use next.js I need to replace the entire server architecture 😣 , future projects can be considered, but now I have built this project, I just want to find a library similar to react-async-bootstrapper that can solve data synchronization.

@duynbicts
Copy link

@chnliquan Did you resolve this problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external dependency Blocked by external dependency, we can’t do anything about it
Projects
None yet
Development

No branches or pull requests

4 participants