Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions examples/with-apollo-auth/lib/withApollo.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ export default App => {

static async getInitialProps (ctx) {
const {
Component,
router,
AppTree,
ctx: { req, res }
} = ctx
const apollo = initApollo(
Expand Down Expand Up @@ -48,14 +47,7 @@ export default App => {
// and extract the resulting data
try {
// Run all GraphQL queries
await getDataFromTree(
<App
{...appProps}
Component={Component}
router={router}
apolloClient={apollo}
/>
)
await getDataFromTree(<AppTree {...appProps} apolloClient={apollo} />)
} catch (error) {
// Prevent Apollo Client GraphQL errors from crashing SSR.
// Handle them in components via the data.error prop:
Expand Down Expand Up @@ -89,7 +81,7 @@ export default App => {
}

render () {
return <App {...this.props} apolloClient={this.apolloClient} />
return <App apolloClient={this.apolloClient} {...this.props} />
}
}
}
13 changes: 3 additions & 10 deletions examples/with-apollo/lib/with-apollo-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default App => {
return class Apollo extends React.Component {
static displayName = 'withApollo(App)'
static async getInitialProps (ctx) {
const { Component, router } = ctx
const { AppTree } = ctx

let appProps = {}
if (App.getInitialProps) {
Expand All @@ -20,14 +20,7 @@ export default App => {
if (typeof window === 'undefined') {
try {
// Run all GraphQL queries
await getDataFromTree(
<App
{...appProps}
Component={Component}
router={router}
apolloClient={apollo}
/>
)
await getDataFromTree(<AppTree {...appProps} apolloClient={apollo} />)
} catch (error) {
// Prevent Apollo Client GraphQL errors from crashing SSR.
// Handle them in components via the data.error prop:
Expand Down Expand Up @@ -55,7 +48,7 @@ export default App => {
}

render () {
return <App {...this.props} apolloClient={this.apolloClient} />
return <App apolloClient={this.apolloClient} {...this.props} />
}
}
}