-
Notifications
You must be signed in to change notification settings - Fork 12k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prerendered home page overwrites app-shell, causing flash of home page on non-prerendered routes #28580
Comments
This is functioning as expected. Since the root page is pre-rendered, the app shell is generated in the Alternatively, you might also consider pre-rendering the routes with parameters and/or enabling SSR. |
@alan-agius4 there is no |
@alan-agius4 can you please reopen this? The |
… prerendering or SSR are enabled This commit addresses an issue where `index.csr.html` was not being generated when SSR was disabled and prerendering was enabled. Closes angular#28580
… prerendering or SSR are enabled This commit addresses an issue where `index.csr.html` was not being generated when SSR was disabled and prerendering was enabled. Closes angular#28580
@alan-agius4 thanks for reopening. I temporarily set |
@aeslinger, you're right that the contents of Unforutnly, the fix will be tricky to backport as there have been significant changes and improve in SSG and SSR on the main branch. |
… prerendering or SSR are enabled This commit addresses an issue where `index.csr.html` was not being generated when SSR was disabled and prerendering was enabled. Closes #28580
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. |
Command
build
Is this a regression?
The previous version in which this bug was not present was
No response
Description
This is a follow-up to #28344
I have an Angular 18 site in which I implemented app-shell. In my angular.json I have "prerender": true and "ssr": false and when I run ng build, I can see the shell contents in the main index.html as expected.
However, if I add a route for the homepage such as
{ path: '', loadComponent: () => import('src/app/dashboard/dashboard.component').then(x => x.DashboardComponent) }
, then I see the prerendered content of dashboard instead of shell in the index.html. I believe this is why the dashboard content flashes for a moment when navigating to deep links for non-prerendered routes.The workaround is to have your homepage route be something like
/home
instead of/
and then include{ path: '', pathMatch: 'full', redirectTo: 'home' }
in your routes, however, this redirect costs me ~300ms according to Chrome Lighthouse and I would like the canonical url of my root page to actually be my root page.How can I prerender the site including the homepage which has a route of
/
, but still have the shell display while loading deep links to non-prerendered routes?Minimal Reproduction
angular.json
to have "prerender": true and "ssr": false.ng build
.http-server
on the dist folder.ng g c dashboard
.{ path: '', loadComponent: () => import('src/app/dashboard/dashboard.component').then(x => x.DashboardComponent) }
.ng build
again.http-server
on the dist folder.Exception or Error
No response
Your Environment
Angular CLI: 18.2.3
Node: 22.3.0
Package Manager: yarn 1.22.17
OS: win32 x64
Angular: 18.0.4
... animations, cdk, cdk-experimental, common, compiler, core
... elements, forms, material, platform-browser
... platform-browser-dynamic, platform-server, router
Package Version
@angular-devkit/architect 0.1802.1
@angular-devkit/build-angular 18.2.1
@angular-devkit/core 18.2.3
@angular-devkit/schematics 18.2.3
@angular/cli 18.2.3
@angular/compiler-cli 18.2.3
@angular/ssr 18.2.0
@schematics/angular 18.2.3
rxjs 7.8.1
typescript 5.4.5
zone.js 0.14.10
Anything else relevant?
No response
The text was updated successfully, but these errors were encountered: