GroupBy: RxJS’ Secret Weapon for Complex UIs
summary
Recreates a movie-picker UI that keeps frontend and backend state consistent while users smash per-item buttons by using RxJS operators: a dispatcher Subject, optimistic UI updates, then groupBy by movieId to split actions into per-item streams, apply per-movie switchMap (or concatMap) for request cancellation without global backlog, and a duration selector implemented with timeoutWith + ignoreElements to auto-tear down groups after 15s. Result: cancels irrelevant requests per movie, avoids race conditions and backpressure, and prevents the groupBy memory leak.
AI-written summary · about
chapters (15)
- 0:00Introduction to RxJS GroupBy
- 3:27Dispatcher pattern overview
- 7:01Mapping operators explained
- 8:03MergeMap race condition demo
- 9:30ConcatMap back pressure issue
- 11:15SwitchMap cancellation behavior
- 13:21GroupBy solves race conditions
- 15:08Higher order observables explained
- 16:52GroupBy key selector explained
- 20:26GroupBy memory leak problem
- 21:52TimeoutWith cleanup mechanism
- 23:38Fixing GroupBy with ignoreElements
- 25:02Full GroupBy implementation
- 27:27Optimizing with mergeMap
- 28:10Architectural benefits of GroupBy
related talks
43mAdvanced patterns in RxJS - Operating heavily dynamic UI’s with RxJS
34mOperate Heavily Dynamic UIs with RxJS
01h 10mRxJS Advanced Patterns – Operate Heavily Dynamic UIs
28mOperate Heavily Dynamic UI’s with Rxjs
24mAdding Even More Fun to Functional Programming With RXJS
34mEffective Reactive Architecture
47mCool RxJS Tricks
31mCollect, Combine, and Cache RxJS Streams for User-Friendly Results...
