Skip to content
Open
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
6 changes: 5 additions & 1 deletion pages/_document.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ class DocumentWithApollo extends Document {
* Render the page through Apollo's `getDataFromTree` so the cache is populated.
* Unfortunately this renders the page twice per request... There may be a way around doing this, but I haven't quite ironed that out yet.
*/
await getDataFromTree(<ctx.AppTree {...ctx.appProps} />);
await getDataFromTree(
<ApolloProvider client={apolloClient}>
<ctx.AppTree {...ctx.appProps} />
</ApolloProvider>
);

/**
* Render the page as normal, but now that ApolloClient is initialized and the cache is full, each query will actually work.
Expand Down