Commit 3949c82b authored by Wes Bos's avatar Wes Bos Committed by Tim Neutkens

Add missing url prop (#4078)

This was causing react-apollo  to crash on any SSR page that needed the page's query to make the GraphQL queries. 

It's magically passed on the client, but we have to manually pass it to the composed component here
parent 2ba8ad97
...@@ -32,9 +32,16 @@ export default ComposedComponent => { ...@@ -32,9 +32,16 @@ export default ComposedComponent => {
// and extract the resulting data // and extract the resulting data
const apollo = initApollo() const apollo = initApollo()
try { try {
// create the url prop which is passed to every page
const url = {
query: ctx.query,
asPath: ctx.asPath,
pathname: ctx.pathname,
};
// Run all GraphQL queries // Run all GraphQL queries
await getDataFromTree( await getDataFromTree(
<ComposedComponent ctx={ctx} {...composedInitialProps} />, <ComposedComponent ctx={ctx} url={url} {...composedInitialProps} />,
{ {
router: { router: {
asPath: ctx.asPath, asPath: ctx.asPath,
......
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