Every Angular engineer who has maintained a metrics-heavy admin portal knows the stutter. A single WebSocket tick flips one pod status badge, and the entire browser tab freezes for 40 milliseconds. When I first hit this on an internal deployment console, our team blamed backend API latency. Five minutes with a Chrome DevTools flamegraph proved otherwise. The bottleneck lived inside Angular’s change detection cycle.
The Real-World Problem: Tree-Wide Checks and RxJS Boilerplate
Imagine a live cluster dashboard with 40 service cards, a filter bar, and an active-alerts sidebar—around 350 component instances in total. Every two seconds, a WebSocket pushes fresh CPU and memory numbers. Under Angular’s default setup, each tick forces the framework to check hundreds of bindings that never changed.
Teams usually fight back with BehaviorSubject, combineLatest, and the async pipe. Soon, a basic filter toggle requires three observables, a cleanup subject, and manual markForCheck() calls. Miss one takeUntilDestroyed() in a feature module, and browser memory climbs past 1.2 GB over an eight-hour shift.
Root Cause Analysis: Why Zone.js and Stream-First State Struggle
Fixing that sluggishness starts with tracing what Angular actually does when a value updates.
Zone.js Monkey-Patching
Classic Angular relies on zone.js to guess when state might have changed. Zone.js monkey-patches browser APIs like setTimeout, Promise, addEventListener, and fetch. Whenever any async task finishes—even a harmless mousemove listener or a background telemetry ping—Angular walks the component tree from top to bottom, comparing old and new bindings.
Coarse Component Boundaries and RxJS Glitches
RxJS excels at asynchronous event streams over time, not synchronous UI state. Derive state from two BehaviorSubject instances with combineLatest, and updating both synchronously causes the combined stream to emit an intermediate, half-updated value. That classic “glitch” wastes template evaluations. Worse, even with ChangeDetectionStrategy.OnPush, the async pipe calls markForCheck(), marking the entire component and every ancestor up to the root dirty.
Solutions Compared: RxJS State vs. OnPush vs. Angular Signals
Modern Angular gives us three main patterns for reactive UI state. Here is how they hold up in production:
- Default Zone.js + BehaviorSubject: Quick to prototype, but triggers tree-wide dirty checking and leaks memory if subscriptions outlive the component.
- OnPush + RxJS + Async Pipe: Skips unchanged subtrees, yet forces heavy stream wiring for simple synchronous state like modal flags or search inputs.
- Angular Signals: Tracks dependencies at the template expression level. Signals are synchronous, glitch-free, and require zero manual unsubscription.
Seeing the Difference in Code
Compare how a filtered node list looks in both styles. First, the familiar RxJS version:
import { Component, ChangeDetectionStrategy } from '@angular/core';
import { BehaviorSubject, combineLatest, map } from 'rxjs';
interface NodeStatus {
name: string;
healthy: boolean;
}
@Component({
selector: 'app-node-list-rxjs',
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<input (input)="search$.next($any($event.target).value)" placeholder="Filter nodes..." />
@for (node of filteredNodes$ | async; track node.name) {
<div>{{ node.name }} - {{ node.healthy ? 'UP' : 'DOWN' }}</div>
}
`
})
export class NodeListRxjsComponent {
private nodes$ = new BehaviorSubject<NodeStatus[]>([
{ name: 'api-prod-01', healthy: true },
{ name: 'worker-prod-02', healthy: false }
]);
search$ = new BehaviorSubject<string>('');
filteredNodes$ = combineLatest([this.nodes$, this.search$]).pipe(
map(([nodes, term]) =>
nodes.filter(n => n.name.toLowerCase().includes(term.toLowerCase()))
)
);
}
Now look at the same component rewritten with signal() and computed():
import { Component, ChangeDetectionStrategy, signal, computed } from '@angular/core';
interface NodeStatus {
name: string;
healthy: boolean;
}
@Component({
selector: 'app-node-list-signals',
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<input (input)="search.set($any($event.target).value)" placeholder="Filter nodes..." />
@for (node of filteredNodes(); track node.name) {
<div>{{ node.name }} - {{ node.healthy ? 'UP' : 'DOWN' }}</div>
}
`
})
export class NodeListSignalsComponent {
private nodes = signal<NodeStatus[]>([
{ name: 'api-prod-01', healthy: true },
{ name: 'worker-prod-02', healthy: false }
]);
search = signal('');
filteredNodes = computed(() => {
const term = this.search().toLowerCase();
return this.nodes().filter(n => n.name.toLowerCase().includes(term));
});
}
No BehaviorSubject, no combineLatest, and no async pipe. Better yet, computed() is lazy and memoized. It recalculates only when nodes or search changes and the template actually reads filteredNodes().
The Best Approach: Signals for State, RxJS at the Async Boundary
Ripping out RxJS altogether is the wrong goal. RxJS still wins at async orchestration: debouncing search inputs, retrying failed HTTP calls with exponential backoff, or multiplexing WebSockets. Keep RxJS at the network and event boundary, and let Signals own synchronous UI state.
1. Centralize Feature State in a Signal Store Service
Expose read-only views with .asReadonly() so components cannot mutate state directly. When data arrives from an observable, bridge it cleanly using toSignal() from @angular/core/rxjs-interop, which handles unsubscription automatically:
import { Injectable, computed, inject, signal } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { toSignal } from '@angular/core/rxjs-interop';
import { catchError, of } from 'rxjs';
export interface Deployment {
id: string;
service: string;
status: 'running' | 'failed';
}
@Injectable({ providedIn: 'root' })
export class DeploymentStore {
private http = inject(HttpClient);
private filterStatus = signal<'all' | 'running' | 'failed'>('all');
private deployments = toSignal(
this.http.get<Deployment[]>('/api/deployments').pipe(catchError(() => of([]))),
{ initialValue: [] }
);
readonly activeFilter = this.filterStatus.asReadonly();
readonly visibleDeployments = computed(() => {
const status = this.filterStatus();
const items = this.deployments();
return status === 'all' ? items : items.filter(d => d.status === status);
});
readonly failedCount = computed(
() => this.deployments().filter(d => d.status === 'failed').length
);
setFilter(status: 'all' | 'running' | 'failed'): void {
this.filterStatus.set(status);
}
}
2. Use effect() Sparingly and Never for Derived State
One common trap is calling effect() to copy one signal into another. That recreates the exact tangled data flow people disliked in manual RxJS subscriptions. Derive values with computed(), and save effect() inside an injection context for real side effects like syncing preferences to localStorage:
import { Injectable, effect, signal } from '@angular/core';
@Injectable({ providedIn: 'root' })
export class ThemeService {
theme = signal<'dark' | 'light'>('dark');
constructor() {
effect(() => {
localStorage.setItem('ops-theme', this.theme());
});
}
}
3. Pair Signals with OnPush and Zoneless Change Detection
Once your templates read Signals under ChangeDetectionStrategy.OnPush, Angular knows the exact view affected by an update. You can drop zone.js entirely—trimming roughly 15 KB gzipped from your bundle—by enabling zoneless change detection in app.config.ts:
# Ensure your workspace is on a modern Angular release with stable Signals and zoneless APIs
ng update @angular/core @angular/cli
import { ApplicationConfig, provideZonelessChangeDetection } from '@angular/core';
export const appConfig: ApplicationConfig = {
providers: [
provideZonelessChangeDetection()
]
};
On our own internal observability portal, moving table sorting, filter bars, and live alert counters off nested RxJS subjects paid off fast. Worst-case frame times during bursty metric updates dropped from 42 ms to under 6 ms, and we deleted roughly 35% of our component state boilerplate.
Quick Migration Checklist for Your Team
- Keep
HttpClient, WebSocket retries, and debounced inputs in RxJS, then convert the final stream withtoSignal(). - Swap
BehaviorSubjectstate fields forsignal()andasReadonly(). - Replace
combineLatest+mapview models withcomputed(). - Set
ChangeDetectionStrategy.OnPushon every component so Signal updates refresh only the views that actually changed.
Pick one noisy component this week, swap its local BehaviorSubject state for signal() and computed(), and record a before-and-after profile in Chrome DevTools. The drop in wasted scripting time shows up on the very first run.

