Commit ccb188ab authored by Divyendu Singh's avatar Divyendu Singh Committed by Tim Neutkens

Update withData.js - support withRouter HOC (#3286)

Add support for using withRouter as HOC with this example.

Passing router context manually fixes this, based on, https://github.com/zeit/next.js/issues/2908#issuecomment-338244804
parent 5260736e
...@@ -54,7 +54,13 @@ export default ComposedComponent => { ...@@ -54,7 +54,13 @@ export default ComposedComponent => {
<ComposedComponent url={url} {...composedInitialProps} /> <ComposedComponent url={url} {...composedInitialProps} />
</ApolloProvider> </ApolloProvider>
) )
await getDataFromTree(app) await getDataFromTree(app, {
router: {
query: context.query,
pathname: context.pathname,
asPath: context.asPath
}
})
// Extract query data from the Apollo's store // Extract query data from the Apollo's store
const state = apollo.getInitialState() const state = apollo.getInitialState()
......
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