Skip to content

Commit

Permalink
Fix TypeError in with-graphql-hooks example (#9658)
Browse files Browse the repository at this point in the history
Reported at #9617

Use `AppTree` so that `withRouter` works correctly.
  • Loading branch information
supaspoida authored and Luis Alvarez D committed Dec 12, 2019
1 parent 867c459 commit c4567a1
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions examples/with-graphql-hooks/lib/with-graphql-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default App => {
return class GraphQLHooks extends React.Component {
static displayName = 'GraphQLHooks(App)'
static async getInitialProps(ctx) {
const { Component, router } = ctx
const { AppTree } = ctx

let appProps = {}
if (App.getInitialProps) {
Expand All @@ -22,14 +22,7 @@ export default App => {
try {
// Run all GraphQL queries
graphQLState = await getInitialState({
App: (
<App
{...appProps}
Component={Component}
router={router}
graphQLClient={graphQLClient}
/>
),
App: <AppTree {...appProps} graphQLClient={graphQLClient} />,
client: graphQLClient,
})
} catch (error) {
Expand Down

0 comments on commit c4567a1

Please sign in to comment.