1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

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
This commit is contained in:
Divyendu Singh 2017-11-15 15:14:06 +05:30 committed by Tim Neutkens
parent 5260736e33
commit ccb188ab6b

View file

@ -54,7 +54,13 @@ export default ComposedComponent => {
<ComposedComponent url={url} {...composedInitialProps} />
</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
const state = apollo.getInitialState()