-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
Invaild hook call when running builded docz #1050
Comments
Hello @shmidt-i Thanks for reporting this, I got the same issue here : #1037 The problem is that two versions of React are being included in the production build the one in /.docz/node_modules/react and /node_modules/react I'll start working on a fix as soon as I fix the "interactivity" problem of the built version. I will update here when it's released. Meanwhile, which docz version are you using ? |
Docz version: 2.0.0-rc.10
Also, did manual deduplication of both yarn.lock's on the top level and in .docz/ UPD: also, same goes for react-dom |
Yep I mistakenly said versions, I meant 2 instances of React being used in the prod build. To confirm this, try removing |
That works indeed! But playground now just renders the component inside, no live :( |
Thanks for the offer to help ! Hopefully it won't be necessary, I already started working on a fix that should be done in a couple of hours. Will update here when I release it. |
Should be fixed in If updating docz in an existing project : rm -rf .docz/ && yarn add docz@next && yarn docz dev yarn docz build && yarn docz serve Could you let me know if it works as expected on your project ? |
Yes indeed! Nice job!! Some things are still broken, but I'm gonna create other issues out of that ;) |
Awesome! Keep them coming so we can get to a flawless v2 :) |
Same question. but when I close typescript, the problem resolved. |
Bug Report
Describe the bug
After
docz build
when you serve the files and open the application, you have runtime error, which makes JS fail and the page not interactiveA clear and concise description of what the bug is.
Error: Minified React error #321; visit https://reactjs.org/docs/error-decoder.html?invariant=321 for the full message or use the non-minified dev environment for full errors and additional helpful warnings
Invalid hook call, which can be due to many things.
To Reproduce
docz build
docz serve
Expected behavior
Builded page should work
Environment
Additional context/Screenshots
Happens in @mdx-js's useMDXComponents hook:
var contextComponents = React.useContext(MDXContext);
<- this line shoots for some reason.yarn.lock's entries:
So, versions match at least
No errors during build step, only because I redefined Header and NavLink components in gatsby-theme-docz. Also, for some reason SSR for styled-components was broken and styled-components stylesheet updating was broken in playground, which I fixed locally and maybe can submit it later.
Also, dev mode works just okay.
Big thanks if somebody will have time to look through this issue!
The text was updated successfully, but these errors were encountered: