question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

async data does not render on server

See original GitHub issue

Bug Report

What is the expected behavior?

Wait for all async calls (promises included) to resolve before rendering the page.

What is the current behavior?

The server doesn’t wait for the async promises to resolve before rendering

What modules are related to this issue?

- [ ] aspnetcore-engine
- [ ] common
- [ ] express-engine
- [ ] hapi-engine
- [ ] module-map-ngfactory-loader

Minimal reproduction with instructions:

please check this repo: https://github.com/GabrielCoriiu/universal-starter-contentful-async and this: https://github.com/angular/universal-starter/issues/181#issuecomment-412262601

What is the use-case or motivation for changing an existing behavior?

SEO

Environment:

@nguniversal versions

  • aspnetcore-engine:
  • common:
  • express-engine:
  • hapi-engine:
  • module-map-ngfactory-loader:
<!--
Output from: `ng --version`.
If nothing, output from: `node --version` and `npm --version`.
  Windows (7/8/10). Linux (incl. distribution). macOS (El Capitan? Sierra?)
-->

Is there anything else we should know?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
GabrielCoriiucommented, Oct 1, 2018

It is indeed the case that there was no transfer state between the server and the client. Now it works like a charm. I guess this can be closed. Thanks @Gorniv

1reaction
Gornivcommented, Sep 21, 2018

contentfull don’t use TransferState for sync server and browser. Read how to work TransferState and look https://github.com/Angular-RU/angular-universal-starter/blob/master/src/app/transfer-back/transfer-back.component.ts

Read more comments on GitHub >

github_iconTop Results From Across the Web

async data does not render on server · Issue #181 - GitHub
I actually do async requests to mongodb, and getting no data rendered on a server. So it does not solve the SEO of...
Read more >
How To Handle Async Data Loading, Lazy Loading, and Code ...
Notice that the component renders before the data is loaded. The advantage with asynchronous code is that it won't block the initial render....
Read more >
Server side rendering with async data fetch - Stack Overflow
We want to server side render our pages that should be filled by the data from our data sources. This transaction has to...
Read more >
Resolving async state while server-rendering · Pullstate
hasAsyncStateToResolve () , which will return true unless there is no async state in our React tree to resolve. Inside this loop we...
Read more >
React Frontload - David Nicholas Williams
Data loading is, of course, async. The client component-centric data loading pattern is nice, but it's incompatible with synchronous server render. React simply ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found