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:
parent
5260736e33
commit
ccb188ab6b
|
@ -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()
|
||||||
|
|
Loading…
Reference in a new issue