Comments (8)
Ok we are trying to create a minimal reproduction to report an issue.
from angular.
Without a reproduction, it will be impossible to diagnose and verify this report. For example, we don't know what the difference in the two routes is - perhaps the route with a slug is waiting on a database call to load.
from angular.
Without a reproduction, it will be impossible to diagnose and verify this report. For example, we don't know what the difference in the two routes is - perhaps the route with a slug is waiting on a database call to load.
You can find an example in blog section of this website:
Here are the codes of the blog.routes.ts file:
export default [
{ path: '', component: BlogMainComponent },
{ path: 'aurora-borealis', component: BlogArticleComponent, data: { slug: 'aurora-borealis' } },
{ path: 'scandinavia-nordics-of-europe', component: BlogArticleComponent, data: { slug: 'scandinavia-nordics-of-europe' } },
{ path: 'travel-without-a-visa', component: BlogArticleComponent, data: { slug: 'travel-without-a-visa' } },
{ path: 'finnish-foods', component: BlogArticleComponent, data: { slug: 'finnish-foods' } },
{ path: 'sultan-begum-mansion', component: BlogArticleComponent, data: { slug: 'sultan-begum-mansion' } },
{ path: 'french-croissants-and-austrian-roots', component: BlogArticleComponent, data: { slug: 'french-croissants-and-austrian-roots' } },
{ path: 'disneyland', component: BlogArticleComponent, data: { slug: 'disneyland' } },
{ path: 'blast-off-barcelona-beaches', component: BlogArticleComponent, data: { slug: 'blast-off-barcelona-beaches' } },
{ path: 'charles-bridge', component: BlogArticleComponent, data: { slug: 'charles-bridge' } },
**{ path: ':slug', component: BlogArticleComponent },**
{ path: 'category/:category', component: BlogCategoryComponent },
] satisfies Route[];
In order to prevent high-traffic pages from loading slowly, I had to manually enter some slugs, but I left the rest dynamic.
I passed the parameter for the API call in manual routes through data. This is a part of the code from the blog-article.component.ts file:
const data = this.activatedRoute.snapshot.data['slug'];
if (data) {
this.slug = data;
this.init();
} else {
this.activatedRoute.params.subscribe(params => {
if (params['slug']) {
this.slug = params['slug'];
this.init();
}
});
}
The initial document load time for this link parsouatravel.com/blog/aurora-borealis (the route I entered manually) is only 50 ms.
However, the initial document load time for this link that I did not enter manually parsouatravel.com/blog/the-lion-s-rock is 1.03 s
The speed of retrieving data from the database and API call does not make much difference.
from angular.
@majidkhaleghian, kindly provide a runnable minimal reproduction.
You can read here why this is needed. A good way to make a minimal repro is to create a new app via ng new repro-app
and adding the minimum possible code to show the problem. Then you can push this repository to github and link it here.
from angular.
Closing due to lack of a runnable reproduction.
If the problem still exists in your application, please open a new issue and follow the instructions in the issue template.
from angular.
@majidkhaleghian Did you find a solution for your issue? We're experiencing the exact same delay using the "**" wildcard route for the same usecase as yours (loading dynamic slugs for a cms).
from angular.
@majidkhaleghian Did you find a solution for your issue? We're experiencing the exact same delay using the "**" wildcard route for the same usecase as yours (loading dynamic slugs for a cms).
Unfortunately, I couldn't find a solution.
The only way to eliminate the delay is to define all routes statically. This can be done either in the blog.routes.ts file or through routes.txt.
from angular.
Likely your are using prerendering for non-parameterized routes.
You can find more information about this issue at: #55529 (comment)
from angular.
Related Issues (20)
- Add support for using functions as pipes HOT 6
- Bug in @placeholder block causing delay in server-side rendering
- can't get the images to show HOT 1
- The update.angular.io does not show how to update angular material although the checkbox is checked HOT 1
- Angular's web components not working inside AngularJS structural directives HOT 2
- Missing built-in Pipes API page HOT 1
- Differences in change detection between components using @for vs *ngFor HOT 1
- NgZoneSchedulingMode not exported HOT 1
- Page Not Found HOT 1
- Functions are missing from localForage after updating Angular to latest version HOT 2
- "updateOn: 'blur'" does not work in formBuilder/formControl HOT 11
- App-shell docs are out-of-date
- https://angular.dev/guide/security not found HOT 2
- Destroy component itself HOT 5
- Image lazy loading doesn't work in SSR when using ngTemplateOutlet and disabled hydration
- @angular/compiler `parseTemplate` fn does not properly parse `HTML` string element text content containing `@` HOT 2
- Angular 17 SSR: Slow server response time when using wildcard route HOT 5
- ERROR LOADING PAGES AFTER USE router.navigate
- SSR fails when root AppComponent in index.html is self-closing HOT 1
- foo = signal(''): if string is empty, !!foo () returns false HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular.