For many, Reactive programming seems like a conceptually elegant approach that
falls apart the moment you try to do any serious programming. When adding
essential error handling, refreshable state, etc. into an application, many
folks see their codebases move further from the promise of clean, elegant
reactive transforms. It doesn't have to be this way. While I've argued before for cleaner display…
Read more →
Sometimes, the best way to learn a new concept is to try to implement it. With
my journey with reactive programming, my attempts at implementing Observables
were key to to my ability to intuit how to best use them. In this post, we'll be
trying various strategies of implementing an Observable and see if we can make
get to working solution. I'll be using TypeScript and working to implement…
Read more →
When testing a codebase in Angular Ivy, I ran into a bunch of test failures I
wasn't seeing before. ExpressionChangedAfterItHasBeenCheckedError s were being
thrown around. In debugging these failures, I found that many of them are the
results of side-effects in Observables and Observable pipe operations. I
happened to describe these earlier in my piece on
Observables, Side-effects, and…
Read more →
My previous articles on using AsyncPipe
and
data refresh patterns in Angular
hint at some common anti-patterns dealing with Observables. If there’s any
common thread in my advice, it is: delay unpacking an Observable into its
scalar types when performing logic you can rewrite as side-effect-free,
leaving code with side-effects for subscription callbacks and other downstream
logic. My two…
Read more →
Part of why I recommend using RxJS Observable s all the way through in Angular
TypeScript code, and
only unpacking them at the closest point to where the UI is declared (often using the | async pipe) ,
is because it makes other transformations on an Observable available and
convenient. Two such examples include retry and refresh logic. Two common reasons to reload/refresh data being…
Read more →