Prevent SSR crash from GraphQL errors again.
This commit is contained in:
parent
9390f514a8
commit
24305dc3e6
@ -45,13 +45,17 @@ export default Composed =>
|
|||||||
if (ctx.req) {
|
if (ctx.req) {
|
||||||
const apolloClient = createApolloClient()
|
const apolloClient = createApolloClient()
|
||||||
|
|
||||||
await getDataFromTree(
|
try {
|
||||||
<App
|
await getDataFromTree(
|
||||||
router={new Router(ctx.pathname, ctx.query, ctx.asPath)}
|
<App
|
||||||
pageProps={{ apolloClient, pageProps: props }}
|
router={new Router(ctx.pathname, ctx.query, ctx.asPath)}
|
||||||
Component={this.renderPage}
|
pageProps={{ apolloClient, pageProps: props }}
|
||||||
/>
|
Component={this.renderPage}
|
||||||
)
|
/>
|
||||||
|
)
|
||||||
|
} catch (error) {
|
||||||
|
// Prevent crash from GraphQL errors.
|
||||||
|
}
|
||||||
|
|
||||||
props.cache = apolloClient.cache.extract()
|
props.cache = apolloClient.cache.extract()
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user