Skip to content

Commit

Permalink
Calling getDataFromTree for dynamic components
Browse files Browse the repository at this point in the history
  • Loading branch information
Borales committed Aug 21, 2018
1 parent 8d9344c commit 330473a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/falcon-client/src/middlewares/ssrMiddleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@ export default async (ctx, next) => {
</ApolloProvider>
);

// First 'getDataFromTree' call - fetching data for static components
await getDataFromTree(markup);
// Mounting async components (defined by GraphQL response)
await asyncBootstrapper(markup);
// Second 'getDataFromTree' call - fetching data for newly mounted dynamic components (DynamicRoute)
await getDataFromTree(markup);

ctx.state.prerenderedApp = renderToString(markup);
ctx.state.asyncContext = asyncContext.getState();
Expand Down

0 comments on commit 330473a

Please sign in to comment.