Skip to content

Commit

Permalink
Update withData.js - support withRouter HOC (#3286)
Browse files Browse the repository at this point in the history
Add support for using withRouter as HOC with this example.

Passing router context manually fixes this, based on, #2908 (comment)
  • Loading branch information
Divyendu Singh authored and timneutkens committed Nov 15, 2017
1 parent 5260736 commit ccb188a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion examples/with-apollo-auth/lib/withData.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit ccb188a

Please sign in to comment.