-
Notifications
You must be signed in to change notification settings - Fork 482
Reflow/re-rendering happening on browser when loading lazy loaded routes #1164
Comments
@rohit-nair |
I am suffering from the same problem... |
I have the same problem in various projects. |
You can view the bug visiting this website that i built using Angular 7 and Angular Universal. |
Hi. We have the same problem as well. The first paint doesn't have the styles and then, after a split-second, reloads with the styles properly rendered. We already tried with the |
I was guided to use https://github.com/angular/preboot with following hack angular/preboot#75 (comment) which solved my issue although in a hacky way. Hope this helps. |
The first thing that needs to be done is set |
@vikerman The issue's descriptions says:
RouterModule.forRoot([
{ path: '', component: HomeComponent, pathMatch: 'full'},
{ path: 'lazy', loadChildren: './lazy/lazy.module#LazyModule'},
{ path: 'lazy/nested', loadChildren: './lazy/lazy.module#LazyModule'}
], {
initialNavigation: 'enabled',
}), |
Hi Guys, any update on this? thanks! |
Still have this flicker |
any update on this? |
Hi @vikerman |
I try this tutorial project to check for flickering problem. And it exists there. Just go to network tab, Disable cache and use Slow 3G network, navigate to /contact and this problem will occurs. |
any updates? The issue hurts a lot... |
This issue still exists. I added initialNavigation: 'enabled', but no use. If I reload / refresh the application, it renders twice. Any update on this? |
This issue still exist, in my case I have a landing page when first visit, landing page is visible for about 100ms, it is really bad ux for first time visitors of the app. Already tried solutions like Transferstate but in my case does not meet my expectations to solve the issue. My landing page do not have any XHR request. I also tried the TransferHttpCacheModule, I notice that first visit, sometimes it loads correctly without the glimpse of landing page, and sometimes it lessens the flicker amount of time for about 20ms but still I can see a glimpse of my landing page, after that it somehow fix my issue, but when I clear my cache, it returns back to previous state which the landing page is visible for about 20ms. Also tried Preboot as what others is suggesting, but it is not suitable for my app, I have a mat-progress-spinner which acts as loading, when preboot is enabled and I hit F5/refresh my loading icon freezes for a while, it does not animate, which I think is very ugly and after about 1sec it goes back to normal state (app is working as usual like normal angular app). I'm actually stuck here and I can't just leave it as it is. |
I am not sure if it works for you. however, after a long time searching finally I did some changes to my web.config file and it solved for me.
|
Thanks for reporting this issue. Luckily, it has already been fixed in one of the recent releases. Please update to the most recent version to resolve the problem. If the problem persists in your application after upgrading, please open a new issue, provide a simple repository reproducing the problem, and describe the difference between the expected and current behavior. You can use |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug Report
What is the expected behavior?
On apps with server side rendering and lazily loaded modules, when landing on pages with lazy loaded components, ie. requesting pages with lazy loaded components such as http://localhost:4000/lazy in the universal-starter demo app, the existing renderings are hydrated from state transfer and are not rendered again client side.
What is the current behavior?
style[ng-transition]
, are removed.The above behavior can be see here. On the right in dev tools is the html markup that is rendered and send from SSR. On the left is the page after all the styles are removed in
appInitializerFactory
.Debugger with breakpoint at the place where the styles are removed.
Meanwhile a request is made to fetch the lazy loaded bundle.
AppComponent
is initialized and the components are re-rendered.What modules are related to this issue?
Minimal reproduction with instructions:
Run following steps to get
universal-starter
demo project up and running.git clone https://github.com/angular/universal-starter.git
npm install
npm run build:ssr && npm run serve:ssr
Now navigate to
http://localhost:4000/lazy
.Open debugger and put a breakpoint in
platform-browser.js
sappInitializerFactory
method where styles are being removed.Reload the page.
What is the use-case or motivation for changing an existing behavior?
Environment:
@nguniversal versions
Is there anything else we should know?
Occurs even with
initialNavigation: 'enabled'
Possible regression as there exists following closed bug reports (to list a few):
The text was updated successfully, but these errors were encountered: