-
Notifications
You must be signed in to change notification settings - Fork 27.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
Router context breaking change in v8.0.0-canary.6 #6042
Comments
Right so the issue is the non-standard rendering of the React tree in getInitialProps, I guess the best solution would be to wrap |
@timneutkens Hello, i'm currently using Next.js v8.1.0, and as I understand after implementation of |
See #7075 (comment) |
Yes, sure, but i think it's smth you should be aware of |
Hey @jaydenseric 👋 I'm encountering this as well. Did you by any chance figure out a workaround? |
Can confirm Next router is not working when using Apollo as well. |
@adamsoffer perhaps you are trying to use the The original issue was resolved when modern context for router was reverted before v8 landed. Modern context would be fine for us, if implemented in a different way so the
I'm looking forward to being able to use the |
Note that it is implemented properly and it's Apollo that causes this for you, not Next.js. |
@timneutkens Would you mind explaining what's causing this bug so I can open up an issue in |
Well So basically I guess we'll have to provide some kind of way to provide the tree, even though we really wouldn't want to as it can lead to misusage. |
@timneutkens @jaydenseric I updated my For now, I get around this issue by wrapping Not ideal, so if anyone has any ideas here let me know! |
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
The
next/router
migration toReact.createContext
in #6030 (Next.js v8.0.0-canary.6) is a breaking change for the GraphQL SSR related examples such aswith-graphql-react
and probablywith-apollo
.To Reproduce
In the
with-graphql-react
example, update thenext
dependency to8.0.0-canary.6
and replace the contents ofpages/index.js
with:With
npm run dev
, in terminal you will see firstundefined
(bad) for the GraphQL preload render and then a router instance when the final SSR happens:I imagine this reproduction would work for the
with-apollo
examples too:https://github.com/zeit/next.js/blob/v8.0.0-canary.6/examples/with-apollo/lib/with-apollo-client.js#L27
Expected behavior
Perhaps the API would be non-breaking from Next.js v7 if
<RouterContext.Consumer>
was used inside of<App>
instead of immediately outside.System information
Additional context
Is this breaking change intentional? If so, I can work it in to
next-graphql-react
and cut a new release for Next.js v8 compatibility.The Apollo examples will also need updating.
The text was updated successfully, but these errors were encountered: