-
Notifications
You must be signed in to change notification settings - Fork 26.8k
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
next 9.1.3 withRouter passes router=null on SSR #9350
Comments
#9105 (comment) suggested that this bug was already present in 9.1.2 have to stick to 9.1.1 now |
Always provide a full reproduction when creating GitHub issues. This is not enough to reproduce. Are you using Apollo or urql by any chance? |
@timneutkens yes, i am using apollo. I just started a reproduction and it does not occure on a fresh nextjs (which was to be expected). So i also thought it has to do with apollo. The apollo client is initialized in _app.jsx according to the older examples (the newer examples don't extend _app anymore, but require you to use a HOC on every page) |
You'll have to use AppTree similarly to the newer examples. That's probably where it broke (the older example was doing non-standard behavior). |
@timneutkens thx, this seems to work. For other falling into the same issue: in it looks something like:
|
@timneutkens sadly, i did not realize, that now SSR with apollo is broken. on SSR all components using apollo now render in loading state and also #9336 seems to have a similar problem. I now will revert to 9.1.1 and stick to that for the moment, because i think others have similar problems and there was an accidental breaking change between 9.1.1 and 9.1.3 |
A note in case anyone makes the same mistake I did: To correct this make sure you import withRouter from "next/router"; |
i only include |
Exactly what happened to me too! |
For anyone having this issue, in my case, I got this issue using Moving the component outside of the head section solved the issue. I'm using next 9.3.4. |
yes that was my problem too |
This is related to #17721 And this is documented https://nextjs.org/docs/api-reference/next/head ℹ️ As the docs say, you MUST have it as direct children of Head, or wrapped at maximum in one level of <React.Fragment> or arrays. |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Bug report
Describe the bug
withRouter passes prop
router: null
to wrapped component whereas in next 9.1.2 it always passed the right object (with query, etc.))To Reproduce
see component above
Expected behavior
withRouter
always injects relevant data)System information
OS: macOs
Version of Next.js: 9.1.3
Additional context
This bug was not present in
9.1.29.1.1. (we skipped 9.1.2)The text was updated successfully, but these errors were encountered: