From 3949c82bdfe268f841178979800aa8e71bbf412c Mon Sep 17 00:00:00 2001 From: Wes Bos Date: Thu, 29 Mar 2018 12:01:12 -0400 Subject: [PATCH] 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 --- examples/with-apollo/lib/withData.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/examples/with-apollo/lib/withData.js b/examples/with-apollo/lib/withData.js index d854618a..2e6326bc 100644 --- a/examples/with-apollo/lib/withData.js +++ b/examples/with-apollo/lib/withData.js @@ -32,9 +32,16 @@ export default ComposedComponent => { // and extract the resulting data const apollo = initApollo() 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 await getDataFromTree( - , + , { router: { asPath: ctx.asPath,