'mergeMap' Unlocked: Mastering Concurrency in RxJS
You know mergeMap, concatMap, exhaustMap, and switchMap - but did you know only one of them accepts a second argument?
π mergeMap stands out with its optional concurrent parameter that limits parallel subscriptions. Think of it as a "concurrency throttle" for your Observables.
_
Use Case (Controlled API Polling):
Imagine you're building a dashboard that needs to:
1οΈβ£ Process multiple files
2οΈβ£ Avoid browser/API overload
3οΈβ£ Maintain upload order
And in this case, the second argument of mergeMap will come in handy as never before:
_
Key benefits of concurrent mergeMap:
β Prevents API flooding
β Balances network load
β Keeps UI responsive
_
Did you know about this hidden gem? π
#Angular #RxJS #JavaScript #WebDev #FrontEnd #Performance
You know mergeMap, concatMap, exhaustMap, and switchMap - but did you know only one of them accepts a second argument?
π mergeMap stands out with its optional concurrent parameter that limits parallel subscriptions. Think of it as a "concurrency throttle" for your Observables.
_
Use Case (Controlled API Polling):
Imagine you're building a dashboard that needs to:
1οΈβ£ Process multiple files
2οΈβ£ Avoid browser/API overload
3οΈβ£ Maintain upload order
And in this case, the second argument of mergeMap will come in handy as never before:
from(fileList).pipe(
mergeMap(
file => uploadFile(file), // upload fn
3 // upload only 3 files at a time
)
).subscribe();
_
Key benefits of concurrent mergeMap:
β Prevents API flooding
β Balances network load
β Keeps UI responsive
_
Did you know about this hidden gem? π
#Angular #RxJS #JavaScript #WebDev #FrontEnd #Performance
1π₯4
π Angular Events (JUNE)
Donβt miss these awesome Angular meetups and conferences happening this June!
π 3 June β Paris Angular Meetup
π 4 June β AngularNYC
π 12 June β Angular.love Spring Camp
π 12 June β Angular Meetup Graz
π 19-20 June β NGRome
π 26 June β Dutch Angular Group
Iβve picked my event - joining Angular.love Spring Camp on June 12th! What about you?
#Angular #WebDev #JavaScript #TechCommunity #Meetup
Donβt miss these awesome Angular meetups and conferences happening this June!
π 3 June β Paris Angular Meetup
π 4 June β AngularNYC
π 12 June β Angular.love Spring Camp
π 12 June β Angular Meetup Graz
π 19-20 June β NGRome
π 26 June β Dutch Angular Group
Iβve picked my event - joining Angular.love Spring Camp on June 12th! What about you?
#Angular #WebDev #JavaScript #TechCommunity #Meetup
Meetup
Paris Angular #3, mar. 3 juin 2025, 18:45 | Meetup
Retrouvez-nous pour ce troisième meetup Angular Paris !
Ce meetup sera hΓ©bergΓ© par [Theodo FinTech](https://fintech.theodo.com/) qui fournira aussi l'apΓ©ritif dinatoire, u
Ce meetup sera hΓ©bergΓ© par [Theodo FinTech](https://fintech.theodo.com/) qui fournira aussi l'apΓ©ritif dinatoire, u
1π₯3π2
π¦₯ RxJS defer β Lazy Observable Initialization
β’ HTTP requests (to avoid premature execution),
β’ dynamic data (that must be fresh on each subscription),
β’ conditional streams (when the Observable depends on runtime state).
π Key Use Cases
1. Fresh Data on Every Subscription
2. Working with Mutable State
3. Conditional Observables
4. Random Value Generation
π« Limitations of defer
β’ No caching β use shareReplay if you need to reuse results.
β’ No request cancellation β combine with switchMap/takeUntil for cancellation control.
β‘When to Choose defer Over Regular Observables?
β’ data must be fresh on every subscribe().
β’ Observable creation is expensive and should be deferred.
β’ the stream depends on mutable conditions (feature flags, auth status etc.).
"Do you know other interesting use cases? Share in the comments!"
#rxjs #javascript #webdev #frontend #angular
defer is a factory that creates an Observable only upon subscription, not at declaration time. Perfect for:β’ HTTP requests (to avoid premature execution),
β’ dynamic data (that must be fresh on each subscription),
β’ conditional streams (when the Observable depends on runtime state).
π Key Use Cases
1. Fresh Data on Every Subscription
const freshData$ = defer(() => of(Date.now()));
// New timestamp on every subscribe()
2. Working with Mutable State
const token$ = defer(() => of(localStorage.getItem('token')));
// Always gets the current token, even if updated
3. Conditional Observables
const api$ = defer(() =>
isLoggedIn ? http.get('/user') : http.get('/guest')
);
4. Random Value Generation
const random$ = defer(() => of(Math.random()));
// New random number per subscription
π« Limitations of defer
β’ No caching β use shareReplay if you need to reuse results.
β’ No request cancellation β combine with switchMap/takeUntil for cancellation control.
β‘When to Choose defer Over Regular Observables?
β’ data must be fresh on every subscribe().
β’ Observable creation is expensive and should be deferred.
β’ the stream depends on mutable conditions (feature flags, auth status etc.).
"Do you know other interesting use cases? Share in the comments!"
#rxjs #javascript #webdev #frontend #angular
1π3π2
πππ Angular v20 is here! πππ
As of May 29, 2025, the stable release of Angular 20 is officially out!
π Highlights (from the article):
- Promoting reactivity features to stable
- New, experimental APIs
- Promoting Zoneless to developer preview
- Solidifying Angular on the server
- and many more...
Useful Links:
π Angular v20 Release on GitHub
https://github.com/angular/angular/releases/tag/20.0.0
π Official Release Blog
https://blog.angular.dev/announcing-angular-v20-b5c9c06cf301
π Release & Support Schedule
https://angular.dev/reference/releases
π¦ Angular CLI v20 Release Notes
https://www.gitclear.com/open_repos/angular/angular-cli/release/20.0.0-next.0
#angular #angular20 #webdev #frontend #JavaScript #TypeScript
As of May 29, 2025, the stable release of Angular 20 is officially out!
π Highlights (from the article):
- Promoting reactivity features to stable
- New, experimental APIs
- Promoting Zoneless to developer preview
- Solidifying Angular on the server
- and many more...
Useful Links:
π Angular v20 Release on GitHub
https://github.com/angular/angular/releases/tag/20.0.0
π Official Release Blog
https://blog.angular.dev/announcing-angular-v20-b5c9c06cf301
π Release & Support Schedule
https://angular.dev/reference/releases
π¦ Angular CLI v20 Release Notes
https://www.gitclear.com/open_repos/angular/angular-cli/release/20.0.0-next.0
#angular #angular20 #webdev #frontend #JavaScript #TypeScript
GitHub
Release 20.0.0 Β· angular/angular
Blog post: https://blog.angular.dev/announcing-angular-v20-b5c9c06cf301
common
Commit
Description
accept undefined inputs in NgTemplateOutlet (#61404)
Allow passing ScrollOptions to View...
common
Commit
Description
accept undefined inputs in NgTemplateOutlet (#61404)
Allow passing ScrollOptions to View...
1π₯5π3
`withComponentInputBinding()`
Simplifying work with router parameters in Angular.
How was it before?
1. Create a variable/property (Signal, BehaivorSubject, Observable, doesn't matter)
2. Inject and subscribe to ActivatedRoute
3. Get the route parameters
4. Write to BS/Signal
π΅βπ« π΅βπ« π΅βπ«
There are quite a lot of manipulations, but we've all gotten used to it and it seems ok. But with withComponentInputBinding(), everything has become much simpler:
1. Create a signal input... and...
That's it!
No extra manipulations and the value is 'in your pocket'. All you need for this to work is to pass wCIB() as an argument to provideRouter().
The feature is not new (it seems to have appeared in Angular 16), but I've rarely seen it in projects.
A bit of technical information from the docs:
The router passes data to input() from:
1. Query parameters (?page=1&sort=asc)
2. Path and matrix parameters (/users/123;details=true)
3. Static route data (data: { role: 'admin' })
4. Resolver results (resolve: { user: userResolver })
π Priorities:
If there are duplicate keys, the data is redefined in the order above β resolvers have the highest priority and will overwrite the rest.
π© Important nuance
If there is no data for input() in the route, it will receive undefined (for example, if the query parameter is removed from the URL).
βΉοΈ How to set default values?
β Through a resolver (so that the data is always in the route)
β Through transform in input() (if you need to handle undefined)
Thanks to the Angular developers for this functionality π. God bless them.
#angular #webdev #frontend #JavaScript #TypeScript
Simplifying work with router parameters in Angular.
How was it before?
1. Create a variable/property (Signal, BehaivorSubject, Observable, doesn't matter)
2. Inject and subscribe to ActivatedRoute
3. Get the route parameters
4. Write to BS/Signal
There are quite a lot of manipulations, but we've all gotten used to it and it seems ok. But with withComponentInputBinding(), everything has become much simpler:
1. Create a signal input... and...
That's it!
No extra manipulations and the value is 'in your pocket'. All you need for this to work is to pass wCIB() as an argument to provideRouter().
The feature is not new (it seems to have appeared in Angular 16), but I've rarely seen it in projects.
A bit of technical information from the docs:
The router passes data to input() from:
1. Query parameters (?page=1&sort=asc)
2. Path and matrix parameters (/users/123;details=true)
3. Static route data (data: { role: 'admin' })
4. Resolver results (resolve: { user: userResolver })
If there are duplicate keys, the data is redefined in the order above β resolvers have the highest priority and will overwrite the rest.
If there is no data for input() in the route, it will receive undefined (for example, if the query parameter is removed from the URL).
β Through a resolver (so that the data is always in the route)
β Through transform in input() (if you need to handle undefined)
Thanks to the Angular developers for this functionality π. God bless them.
#angular #webdev #frontend #JavaScript #TypeScript
Please open Telegram to view this post
VIEW IN TELEGRAM
1π6π2
π Introducing @grandgular/link - The Missing Piece for Angular SEO!
The Problem:
Angular provides built-in Title and Meta services, but mysteriously lacks a solution for managing html <link> tags. Until now, developers had to manipulate the DOM manually π
The Solution:
Meet the Link service - a perfect counterpart to Angular's Meta, but for `html
<link>` elements:
π₯ Key Benefits:
- Full TypeScript support
- Familiar Angular-style API (just like Meta)
- Supports all standard <link> attributes
- SSR-ready out of the box
- Tiny footprint (~2KB)
Works perfectly as a standalone solution - no dependency on our upcoming SEO suite.
π¦ NPM: https://www.npmjs.com/package/@grandgular/link
π» GitHub: https://github.com/Grandgular/link
P.S. This is the first building block in our comprehensive Angular SEO toolkit. What features would you like to see in the full solution?
Let us know in the comments! π
#Angular #SEO #WebDev #Frontend #JavaScript
The Problem:
Angular provides built-in Title and Meta services, but mysteriously lacks a solution for managing html <link> tags. Until now, developers had to manipulate the DOM manually π
The Solution:
Meet the Link service - a perfect counterpart to Angular's Meta, but for `html
<link>` elements:
constructor(private link: Link) {}
ngOnInit() {
// Add canonical link
this.link.addTag({
rel: 'canonical',
href: 'https://your-site.com/page'
});
// Update on route changes
this.link.updateTag({
rel: 'canonical',
href: 'https://your-site.com/new-url'
});
// etc.
}
π₯ Key Benefits:
- Full TypeScript support
- Familiar Angular-style API (just like Meta)
- Supports all standard <link> attributes
- SSR-ready out of the box
- Tiny footprint (~2KB)
Works perfectly as a standalone solution - no dependency on our upcoming SEO suite.
π¦ NPM: https://www.npmjs.com/package/@grandgular/link
π» GitHub: https://github.com/Grandgular/link
P.S. This is the first building block in our comprehensive Angular SEO toolkit. What features would you like to see in the full solution?
Let us know in the comments! π
#Angular #SEO #WebDev #Frontend #JavaScript
7π6π₯3π±2π1
β° Timeouts for HTTP in Angular.
A common practice is to create a wrapper around the HttpClient that is used throughout the project. It often handles tasks like timeouts and retry logic using operators like .pipe(timeout(8000)).
But this solution isn't the most elegant - it adds an extra layer and boilerplate.
What if such a wrapper service doesn't exist in the project, but you need to solve the timeout issue right now?
I believe the most graceful option is to add custom functionality directly to provideHttpClient(). For example, something like withTimeout (look at the picture + code in the comments)
π― What does it offer?
- A global timeout default for all requests
- Flexible rules for specific endpoints
- Clean and readable code without repetitive boilerplate and extra layers.
- All timed-out requests fail with a 408 TimeoutError.
π‘ Using the same principle, you can do the following: withRetry(), withRateLimiting(), withErrorHandler(), etc.
#angular #frontend #javascript #typescript #webdev
A common practice is to create a wrapper around the HttpClient that is used throughout the project. It often handles tasks like timeouts and retry logic using operators like .pipe(timeout(8000)).
But this solution isn't the most elegant - it adds an extra layer and boilerplate.
What if such a wrapper service doesn't exist in the project, but you need to solve the timeout issue right now?
I believe the most graceful option is to add custom functionality directly to provideHttpClient(). For example, something like withTimeout (look at the picture + code in the comments)
π― What does it offer?
- A global timeout default for all requests
- Flexible rules for specific endpoints
- Clean and readable code without repetitive boilerplate and extra layers.
- All timed-out requests fail with a 408 TimeoutError.
π‘ Using the same principle, you can do the following: withRetry(), withRateLimiting(), withErrorHandler(), etc.
#angular #frontend #javascript #typescript #webdev
7π₯6π1