# switchMap

An RxJS transformation operator that maps values to observables, cancels the previous inner observable, and emits values from the new one.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## RxJS finalize operator to execute logic on Observable termination

DevFeed: [RxJS finalize operator to execute logic on Observable termination](<https://devfeed.tech/articles/rxjs-finalize-operator-to-execute-logic-on-observable-termination-21343.md>)

Original publisher: [Read original article](<https://juri.dev/blog/2019/04/rxjs-finalize-operator/>)

Published: 2019-03-04T00:00:00Z

Content type: article

Language: en

Sources: [Juri Strumpflohner](<https://devfeed.tech/sources/juri-strumpflohner.md>)

Topics: [switchMap](<https://devfeed.tech/topics/switchmap.md>), [api server](<https://devfeed.tech/topics/api-server.md>), [User interface design](<https://devfeed.tech/topics/ui-design.md>), [Exception](<https://devfeed.tech/topics/exception.md>)

Tags: [angular](<https://devfeed.tech/tags/angular.md>), [beginner](<https://devfeed.tech/tags/beginner.md>), [observable](<https://devfeed.tech/tags/observable.md>), [operator](<https://devfeed.tech/tags/operator.md>), [rxjs](<https://devfeed.tech/tags/rxjs.md>)

### AI overview

The RxJS `finalize` operator runs cleanup logic when an Observable terminates, including on completion, error, or unsubscription. In the Angular HTTP example, it can re-enable a form button after a request whether the request succeeds or fails, avoiding duplicated success and error handling. The excerpt contrasts this with a success-only callback, which does not run when the Observable errors. Angular HTTP Observables complete when the request finishes, but custom Observables may behave differently, so the example's cleanup timing may not apply to them.

### Source excerpt

Lorem ipsum dolor sit amet

## Guarantee Event Order with RxJS

DevFeed: [Guarantee Event Order with RxJS](<https://devfeed.tech/articles/guarantee-event-order-with-rxjs-21393.md>)

Original publisher: [Read original article](<https://juri.dev/blog/guarantee-event-order-with-rxjs/>)

Published: 2019-01-16T00:00:00Z

Content type: article

Language: en

Sources: [Juri Strumpflohner](<https://devfeed.tech/sources/juri-strumpflohner.md>)

Topics: [switchMap](<https://devfeed.tech/topics/switchmap.md>), [User Interfaces](<https://devfeed.tech/topics/user-interfaces.md>), [Web app](<https://devfeed.tech/topics/webapp.md>), [Publish-subscribe pattern](<https://devfeed.tech/topics/pubsub.md>), [event driven](<https://devfeed.tech/topics/event-driven.md>)

Tags: [angular](<https://devfeed.tech/tags/angular.md>), [async](<https://devfeed.tech/tags/async.md>), [concatmap](<https://devfeed.tech/tags/concatmap.md>), [mergemap](<https://devfeed.tech/tags/mergemap.md>), [ordering](<https://devfeed.tech/tags/ordering.md>), [rxjs](<https://devfeed.tech/tags/rxjs.md>), [switchmap](<https://devfeed.tech/tags/switchmap.md>), [user-interaction](<https://devfeed.tech/tags/user-interaction.md>), [user-interface](<https://devfeed.tech/tags/user-interface.md>)

### AI overview

In the checkbox example, checking an option starts an asynchronous request to add its value, while unchecking removes it immediately. A quick check-then-uncheck can leave the option unselected but still add its value later when the slower request returns. The excerpt proposes piping selection events through an RxJS subject and processing them one at a time, so an uncheck waits for any earlier request to finish. It mentions mapping values to inner observables and emitting in order, but the operator name and implementation are omitted from the excerpt.

### Source excerpt

Lorem ipsum dolor sit amet

## Egghead Lesson: Simple caching with RxJS

DevFeed: [Egghead Lesson: Simple caching with RxJS](<https://devfeed.tech/articles/egghead-lesson-simple-caching-with-rxjs-21336.md>)

Original publisher: [Read original article](<https://juri.dev/blog/2018/11/videolesson-rxjs-caching-angular/>)

Published: 2018-11-10T00:00:00Z

Content type: article

Language: en

Sources: [Juri Strumpflohner](<https://devfeed.tech/sources/juri-strumpflohner.md>)

Topics: [Cache](<https://devfeed.tech/topics/cache.md>), [switchMap](<https://devfeed.tech/topics/switchmap.md>), [Front end](<https://devfeed.tech/topics/frontend.md>), [software-development](<https://devfeed.tech/topics/software-development.md>), [Amazon ElastiCache](<https://devfeed.tech/topics/amazon-elasticache.md>), [Redis](<https://devfeed.tech/topics/redis.md>)

Tags: [angular](<https://devfeed.tech/tags/angular.md>), [api](<https://devfeed.tech/tags/api.md>), [cache](<https://devfeed.tech/tags/cache.md>), [caching](<https://devfeed.tech/tags/caching.md>), [data-freshness](<https://devfeed.tech/tags/data-freshness.md>), [database](<https://devfeed.tech/tags/database.md>), [debugging](<https://devfeed.tech/tags/debugging.md>), [egghead](<https://devfeed.tech/tags/egghead.md>), [headers](<https://devfeed.tech/tags/headers.md>), [in-memory-database](<https://devfeed.tech/tags/in-memory-database.md>), [optimizations](<https://devfeed.tech/tags/optimizations.md>), [performance](<https://devfeed.tech/tags/performance.md>), [redis](<https://devfeed.tech/tags/redis.md>), [rxjs](<https://devfeed.tech/tags/rxjs.md>), [state-management](<https://devfeed.tech/tags/state-management.md>), [store](<https://devfeed.tech/tags/store.md>)

### AI overview

The article presents a simple RxJS-based caching mechanism for Angular, based largely on an implementation described in a Thoughtram article and covered in an Egghead lesson. It cautions that cache invalidation and debugging are difficult because cached data can become stale or hide expected results. The author recommends delaying client-side caching until other optimizations have been tried and considering API-level caching, where data freshness is easier to assess. It notes that NgRx stores can act as an in-memory cache, with the same risk of stale data. The excerpt links to a video and StackBlitz example but does not explain the implementation.

### Source excerpt

Lorem ipsum dolor sit amet

## My Journey replacing Promises with RxJS

DevFeed: [My Journey replacing Promises with RxJS](<https://devfeed.tech/articles/my-journey-replacing-promises-with-rxjs-21332.md>)

Original publisher: [Read original article](<https://juri.dev/blog/2018/10/journey-promises-to-rxjs/>)

Published: 2018-09-30T00:00:00Z

Content type: article

Language: en

Sources: [Juri Strumpflohner](<https://devfeed.tech/sources/juri-strumpflohner.md>)

Topics: [software-development](<https://devfeed.tech/topics/software-development.md>), [switchMap](<https://devfeed.tech/topics/switchmap.md>), [Test-driven development](<https://devfeed.tech/topics/tdd.md>)

Tags: [angular](<https://devfeed.tech/tags/angular.md>), [apis](<https://devfeed.tech/tags/apis.md>), [code-review](<https://devfeed.tech/tags/code-review.md>), [comment](<https://devfeed.tech/tags/comment.md>), [development](<https://devfeed.tech/tags/development.md>), [graph](<https://devfeed.tech/tags/graph.md>), [guest-post](<https://devfeed.tech/tags/guest-post.md>), [handling](<https://devfeed.tech/tags/handling.md>), [http](<https://devfeed.tech/tags/http.md>), [journey](<https://devfeed.tech/tags/journey.md>), [problems](<https://devfeed.tech/tags/problems.md>), [pull-request](<https://devfeed.tech/tags/pull-request.md>), [refactor](<https://devfeed.tech/tags/refactor.md>), [refactoring](<https://devfeed.tech/tags/refactoring.md>), [request](<https://devfeed.tech/tags/request.md>), [rxjs](<https://devfeed.tech/tags/rxjs.md>), [sequence](<https://devfeed.tech/tags/sequence.md>), [service](<https://devfeed.tech/tags/service.md>), [sharepoint](<https://devfeed.tech/tags/sharepoint.md>)

### AI overview

The author describes refactoring an Angular app's Microsoft Graph and SharePoint HTTP requests from Promises back to RxJS Observables, after initially converting Angular's Observable-returning request methods because the team lacked reactive experience. The excerpt explains the existing Promise flow: several requests run in parallel and are awaited together, then chained requests use earlier results. It ends before describing the completed RxJS refactor or its findings.

### Source excerpt

Lorem ipsum dolor sit amet