Skip to content

Commit ccb188a

Browse files
Divyendu Singhtimneutkens
Divyendu Singh
authored andcommitted
Update withData.js - support withRouter HOC (vercel#3286)
Add support for using withRouter as HOC with this example. Passing router context manually fixes this, based on, vercel#2908 (comment)
1 parent 5260736 commit ccb188a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

examples/with-apollo-auth/lib/withData.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,13 @@ export default ComposedComponent => {
5454
<ComposedComponent url={url} {...composedInitialProps} />
5555
</ApolloProvider>
5656
)
57-
await getDataFromTree(app)
57+
await getDataFromTree(app, {
58+
router: {
59+
query: context.query,
60+
pathname: context.pathname,
61+
asPath: context.asPath
62+
}
63+
})
5864

5965
// Extract query data from the Apollo's store
6066
const state = apollo.getInitialState()

0 commit comments

Comments
 (0)