Skip to content

Commit

Permalink
Remove redirect code to the server
Browse files Browse the repository at this point in the history
  • Loading branch information
HaNdTriX committed Sep 4, 2019
1 parent 549a03e commit 8645aed
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions examples/with-apollo/lib/apollo.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,16 @@ export function withApollo (PageComponent, { ssr = true } = {}) {
pageProps = await PageComponent.getInitialProps(ctx)
}

// When redirecting, the response is finished.
// No point in continuing to render
if (ctx.res && ctx.res.finished) {
return pageProps
}

// Run all GraphQL queries in the component tree
// and extract the resulting data:
// Only on the server:
if (typeof window === 'undefined') {
// Only on the server
// When redirecting, the response is finished.
// No point in continuing to render
if (ctx.res && ctx.res.finished) {
return pageProps
}

// Only if ssr is enabled
if (ssr) {
// Only if ssr is enabled
try {
// Run all GraphQL queries
const { getDataFromTree } = await import('@apollo/react-ssr')
Expand Down

0 comments on commit 8645aed

Please sign in to comment.