Unverified Commit db57ad3b authored by Ben Goerdt's avatar Ben Goerdt Committed by GitHub

Fix assignment of props in WithApollo.getInitialProps (#11236)

The props are being assigned incorrectly based on the `inAppContext`, they should be wrapped in `pageProps` when `inAppContext` is true, not the other way around. This will cause a new apollo client to be created during `getDataFromTree` instead of using the one that has already been created on the server.
parent 16a97c87
...@@ -137,9 +137,9 @@ export const withApollo = ({ ssr = false } = {}) => PageComponent => { ...@@ -137,9 +137,9 @@ export const withApollo = ({ ssr = false } = {}) => PageComponent => {
// we need to modify their props a little. // we need to modify their props a little.
let props let props
if (inAppContext) { if (inAppContext) {
props = { ...pageProps, apolloClient }
} else {
props = { pageProps: { ...pageProps, apolloClient } } props = { pageProps: { ...pageProps, apolloClient } }
} else {
props = { ...pageProps, apolloClient }
} }
// Take the Next.js AppTree, determine which queries are needed to render, // Take the Next.js AppTree, determine which queries are needed to render,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment