Async data not rendered in the initial load
See original GitHub issueBug Report
What is the expected behavior?
When I load the application initially all data passed into my components (i.e. header, router-outlet, footer) is rendered. In this case I expect to see links generated from an api in the footer.
What is the current behavior?
More often than not, I see a commented out html line where I expect to see the async data. But right after I reload, I see the data. This is unacceptable because the sole reason for using Angular-Universal (SSR) is for SEO crawl.
What modules are related to this issue?
- [x ] aspnetcore-engine
- [ ] common
- [ ] express-engine
- [ ] hapi-engine
- [ ] module-map-ngfactory-loader
Minimal reproduction with instructions:
What is the use-case or motivation for changing an existing behavior?
SEO Crawl.
Environment:
@nguniversal versions
- aspnetcore-engine: aspnet-prerendering@3.0.1 (i think this is what you eman)
- common:
- express-engine:
- hapi-engine:
- module-map-ngfactory-loader: 5.0.0-beta.5
<!--
Output from: `ng --version`.
Angular CLI: 1.7.0
Node: 8.11.3
OS: win32 x64
Angular: 5.2.5
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router
@angular/cli: 1.7.0
@angular-devkit/build-optimizer: 0.3.1
@angular-devkit/core: 0.3.1
@angular-devkit/schematics: 0.3.1
@ngtools/json-schema: 1.2.0
@ngtools/webpack: 1.10.0
@schematics/angular: 0.3.1
@schematics/package-update: 0.3.1
typescript: 2.5.3
webpack: 3.11.0
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?
Project was created from asp.net core SDK 2.1.302. Leveraging TransferState.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:8 (3 by maintainers)
Top Results From Across the Web
reactjs - Load async data before rendering the DOM
It's normal for the first render to have undefined for the state, since that's what you've set the initial state to, and it...
Read more >How To Handle Async Data Loading, Lazy Loading, and ...
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 >Fetching Asynchronous Data with React Hooks
We fetch our resource and put the result in the state. Our render method uses a ternary operator to decide if we want...
Read more >React Suspense: Lessons Learned While Loading Data
The asynchronous nature of data loading means each of these requests can be returned in any order. As a result, not only will...
Read more >How to fetch data in React with performance in mind
External libraries for data fetching in React - yes or no? ... Shows a loading state until sidebar data is loaded first, renders...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
In your example, change the SSR interceptor not to use
Object.assign
. Userequest.clone({url: fullUrl})
instead.This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.