Dev.to WebDev 🛠 Dev 👁 0 📖 13 min read

Angular Signals Look Easy — Until You Realize Most Signal Bugs Never Throw an Error

Angular Signals Look Easy — Until You Realize Most Signal Bugs Never Throw an Error Nov 23, 2026 · @cristiansifuentes Why senior Angular engineers treat computed, effect, resource, and the RxJS boundary as four differ

Angular Signals Look Easy — Until You Realize Most Signal Bugs Never Throw an Error

 Angular Signals Look Easy — Until You Realize Most Signal Bugs Never Throw an Error

Angular Signals Look Easy — Until You Realize Most Signal Bugs Never Throw an Error

Nov 23, 2026 · @cristiansifuentes

Why senior Angular engineers treat computed, effect, resource, and the RxJS boundary as four different contracts (Angular 22 Edition).

Angular signals look deceptively simple.

At the beginning, everything feels smooth.

readonly products = input.required<Product[]>();
readonly lowStockCount = signal(0);

constructor() {
  effect(() => {
    this.lowStockCount.set(this.products().filter(p => p.quantity < 5).length);
  });
}

The value renders.

The tests pass.

The pull request gets approved.

Nothing throws.

Then you open the network tab.

And you start finding things like:

  • The same request fired three times
  • A selected warehouse that no longer exists
  • A polling interval that survived its component
  • A page that renders fine, until one request fails and the whole view crashes
  • A search box that hits the API on every keystroke

None of these bugs throws an error on the happy path.

That is exactly why they ship.

At that moment, a critical realization emerges:

Signals don't fail loudly.

They fail quietly.

And since Angular 22, there is no excuse left.

resource, httpResource, and rxResource are stable.

chain() and debounced() are part of the toolbox.

The APIs are no longer experimental.

The mistakes are now on us.

TL;DR

Most signal bugs fall into four families:

  • Derived state: copying what should be computed
  • Effects: reacting to the wrong things, or never cleaning up
  • Resources: treating async data as if it were always there
  • The RxJS boundary: opening subscriptions that never close, or losing events in translation

This post walks through 13 patterns that compile, render, and pass review.

And then quietly cost you in production.

Senior Angular engineers don't ask:

Does this signal work?

They ask:

What does this signal depend on, and what depends on it?

Family 1: Derived State — Copying What Should Be Calculated

Mistake 1: Using an effect to keep two signals in sync

Go back to the opening example.

The effect copies a value from products into lowStockCount.

It works.

But it creates two sources of truth.

An effect is a reaction.

It runs after the signals it reads have changed.

For a moment, products and lowStockCount disagree.

Then the effect writes, and everything that depends on lowStockCount gets notified a second time.

The fix is not an optimization.

It is a different primitive:

readonly products = input.required<Product[]>();
readonly lowStockCount = computed(
  () => this.products().filter(p => p.quantity < 5).length
);

A computed is lazy, memoized, and never out of sync with its inputs.

Quick audit for your codebase:

Search for effects that call .set().

Most of them are computeds in disguise.

If it can be derived,

it should never be copied.

Mistake 2: Initializing a signal from another signal

A user picks a warehouse from a list.

The first instinct:

readonly warehouses = input.required<Warehouse[]>();
readonly selected = signal(this.warehouses()[0]);

Two problems.

First, reading a required input in a field initializer throws NG0950, because the input has no value yet.

Second, even when it works, signal(...) reads the source once.

It is a snapshot.

When the list refreshes, selected still points to a warehouse that may not exist anymore.

linkedSignal recomputes the default whenever the source changes, and still lets the user write to it:

readonly selected = linkedSignal(() => this.warehouses()[0]);

But that short form resets to the first item on every refresh.

Even when the user's choice is still in the list.

The long form receives the previous value, so it can keep the user's selection:

readonly selected = linkedSignal<Warehouse[], Warehouse>({
  source: this.warehouses,
  computation: (list, previous) =>
    list.find(w => w.id === previous?.value.id) ?? list[0],
});

Refresh the list, and the user keeps their warehouse.

Remove that warehouse, and the selection falls back gracefully.

A snapshot remembers the past.

A linked signal follows the present.

Mistake 3: Exposing a WritableSignal from a store

@Injectable({ providedIn: 'root' })
export class InventoryStore {
  readonly products = signal<Product[]>([]);
}

Now any component, anywhere, can write this:

this.store.products.set([]);

No validation.

No business rule.

No trace of who did it.

Keep the writable signal private, expose a readonly view, and route every change through a method:

@Injectable({ providedIn: 'root' })
export class InventoryStore {
  private readonly _products = signal<Product[]>([]);
  readonly products = this._products.asReadonly();

  restock(sku: string, units: number) {
    this._products.update(list =>
      list.map(p => (p.sku === sku ? { ...p, quantity: p.quantity + units } : p))
    );
  }
}

Consumers still read products().

They still get updates.

They just can't bypass the rules.

Anyone who has designed a domain model in C# or Java will recognize this.

A public WritableSignal is a public setter.

Public setters invite changes.

Methods negotiate them.

Family 2: Effects — Reacting to the Wrong Things

Mistake 4: Reading signals after await in an async effect

effect(async () => {
  const report = await this.api.loadReport(this.warehouseId());
  this.chart.render(report, this.currency()); // currency() is not tracked
});

An effect tracks dependencies only while it runs synchronously.

Everything after the first await is invisible to it.

Change the currency, and the chart never updates.

Read every signal at the top:

effect(async () => {
  const id = this.warehouseId();
  const currency = this.currency();

  const report = await this.api.loadReport(id);
  this.chart.render(report, currency);
});

Everything before the first await is a dependency.

Everything after it is a surprise.

Mistake 5: Letting incidental reads become dependencies

Every signal an effect reads becomes a reason to run it again.

Including the ones you only needed for context:

effect(() => {
  this.analytics.track('stock_view', {
    sku: this.selectedSku(),
    user: this.session.userName(), // now a trigger too
  });
});

The intent was "track a view when the SKU changes."

The reality is "track a view when the SKU or the user name changes."

And if analytics.track reads signals internally, those become triggers as well.

Decide what should trigger the effect, and wrap the rest in untracked:

effect(() => {
  const sku = this.selectedSku();

  untracked(() =>
    this.analytics.track('stock_view', { sku, user: this.session.userName() })
  );
});

Read what should trigger.

Untrack what should only inform.

Mistake 6: Starting work without stopping it

A warehouse dashboard that polls stock levels:

effect(() => {
  const id = this.warehouseId();
  setInterval(() => this.stock.refresh(id), 30_000);
});

Switch warehouses three times, and three intervals are running.

Two of them refresh warehouses nobody is looking at.

All of them survive the component.

Every effect re-run needs to tear down the previous one:

effect((onCleanup) => {
  const id = this.warehouseId();
  const timer = setInterval(() => this.stock.refresh(id), 30_000);

  onCleanup(() => clearInterval(timer));
});

onCleanup runs before the next execution and when the effect is destroyed.

The same rule applies to listeners, sockets, and third-party widgets.

Every effect that starts something

must also know how to stop it.

Family 3: Resources — Treating Async Data as if It Were Always There

Mistake 7: Ignoring the abortSignal

readonly orders = resource({
  params: () => ({ status: this.status() }),
  loader: ({ params }) =>
    fetch(`/api/orders?status=${params.status}`).then(r => r.json()),
});

When status changes mid-request, the resource abandons the old load.

But the HTTP request keeps running.

The server still does the work.

The browser still downloads the response.

Nobody reads it.

The loader receives an abortSignal for exactly this reason:

loader: ({ params, abortSignal }) =>
  fetch(`/api/orders?status=${params.status}`, { signal: abortSignal })
    .then(r => r.json()),

If your app already uses HttpClient, prefer httpResource.

It goes through the Angular HTTP stack, interceptors included.

Abandoned is not the same as cancelled.

Mistake 8: Reading value() without asking first

readonly product = httpResource<Product>(() => `/api/products/${this.sku()}`);
readonly productName = computed(() => this.product.value()?.name ?? '');

It looks defensive.

It isn't.

In the error state, value() throws.

The optional chaining never gets a chance to run.

One failed request, and the view that reads productName crashes.

hasValue() is both a type guard and a safety check:

readonly productName = computed(() =>
  this.product.hasValue() ? this.product.value().name : ''
);

And in the template, model every state explicitly:

@if (product.hasValue()) {
  <h2>{{ product.value().name }}</h2>
} @else if (product.error()) {
  <p>We couldn't load this product.</p>
} @else if (product.isLoading()) {
  <p>Loading…</p>
}

One more detail.

When the SKU changes, the resource goes back to loading, and value() becomes undefined.

The previous product disappears until the next one arrives.

If you want to keep showing it, that is a design decision.

Make it explicit.

Async data has four states.

Your template should know all of them.

Mistake 9: Letting every keystroke drive a resource

readonly query = signal('');

readonly results = resource({
  params: () => this.query(),
  loader: ({ params, abortSignal }) => searchProducts(params, abortSignal),
});

Type laptop, and the resource starts six loads.

Five of them get aborted.

The server still received all six.

In 2025, the clean fix was a round trip through RxJS: signal to observable, debounceTime, back to signal.

Angular 22 added debounced() (still marked experimental):

readonly query = signal('');
readonly settledQuery = debounced(this.query, 300);

readonly results = resource({
  params: () => this.settledQuery.value() || undefined,
  loader: ({ params, abortSignal }) => searchProducts(params, abortSignal),
});

Three details matter:

  • debounced() returns a Resource, not a signal, so you read .value()
  • It must be created in an injection context
  • || undefined keeps the search idle for an empty query: when params returns undefined, the loader doesn't run

Typing is not intent.

Pausing is.

Mistake 10: Chaining resources through value()

A supplier depends on the product:

readonly supplier = resource({
  params: () => this.product.value()?.supplierId,
  loader: ({ params, abortSignal }) => fetchSupplier(params, abortSignal),
});

While the product is loading, params is undefined.

So the supplier resource goes idle.

The UI can't tell "nothing to show" from "still loading" from "failed upstream."

It just shows nothing.

Angular 22 made chain() part of the stable resource API:

readonly supplier = resource({
  params: ({ chain }) => chain(this.product)?.supplierId,
  loader: ({ params, abortSignal }) => fetchSupplier(params, abortSignal),
});

Now the upstream status flows downstream.

The trap:

Return the chained value itself, not an object around it.

params: ({ chain }) => ({ id: chain(this.product)?.supplierId }), // never undefined

An object is never undefined.

So the loader runs with id: undefined instead of waiting.

Dependent data needs dependent status.

Not just dependent values.

Family 4: The RxJS Boundary — Where Signals and Streams Disagree

Mistake 11: Calling toSignal inside a getter

get lowStockAlerts() {
  return toSignal(this.alerts.lowStock$, { initialValue: [], injector: this.injector });
}

Every call to toSignal opens a new subscription.

A getter runs on every read.

The template reads it on every check.

If lowStock$ triggers an HTTP call, you just multiplied it.

And none of those subscriptions close until the injector is destroyed.

Create the signal once, as a field:

readonly lowStockAlerts = toSignal(this.alerts.lowStock$, { initialValue: [] });

A signal is a value you hold.

Not a value you rebuild.

Mistake 12: Using toObservable for events

readonly lastMovement = signal<StockMovement | null>(null);
readonly movements$ = toObservable(this.lastMovement);

applyBatch(batch: StockMovement[]) {
  batch.forEach(m => this.lastMovement.set(m)); // the audit log sees only the last one
}

Signals hold state.

They don't queue events.

toObservable emits after the signal settles, so five synchronous set() calls produce one emission.

The audit log quietly loses four stock movements.

When every value matters, use a stream:

private readonly movements = new Subject<StockMovement>();
readonly movements$ = this.movements.asObservable();

applyBatch(batch: StockMovement[]) {
  batch.forEach(m => this.movements.next(m));
}

For component events, output() is the equivalent.

State can skip values.

Events can't.

Mistake 13: Calling takeUntilDestroyed() outside an injection context

takeUntilDestroyed() is the right way to tie a subscription to a component's lifetime.

In the constructor, it just works.

In a click handler, it throws NG0203:

startLiveFeed(warehouseId: string) {
  this.feed.stock$(warehouseId)
    .pipe(takeUntilDestroyed()) // NG0203: no injection context here
    .subscribe(level => this.level.set(level));
}

With no argument, it looks for a DestroyRef in the current injection context.

Event handlers and lifecycle hooks don't have one.

Inject it once and pass it explicitly:

private readonly destroyRef = inject(DestroyRef);

startLiveFeed(warehouseId: string) {
  this.feed.stock$(warehouseId)
    .pipe(takeUntilDestroyed(this.destroyRef))
    .subscribe(level => this.level.set(level));
}

Lifetimes don't come from where you are.

They come from what you inject.

So Which Primitive Should You Actually Use?

Most of the 13 mistakes above come from one thing.

Using a primitive for a job it was never designed to do.

Use signal when:

  • The value is a fact the user or the system sets directly
  • Nothing else can derive it

Use computed when:

  • The value can be calculated from other signals
  • Nobody should ever write it by hand

Use linkedSignal when:

  • The value has a sensible default derived from another signal
  • The user can still override it

Use effect when:

  • You need to touch something outside the signal graph: the DOM, storage, analytics, a third-party library
  • And never just to copy one signal into another

Use resource / httpResource when:

  • The value comes from an async request that depends on other signals
  • You need loading, error, and value as first-class states

Use RxJS when:

  • Every event matters, not just the latest value
  • You need time-based operators beyond a simple debounce: buffering, retries with backoff, merging streams

If you remember only one rule from this section, make it this one:

State goes in signals.

Events go in streams.

Async data goes in resources.

The Senior Perspective: Signals Are a Dependency Graph, Not Just State

Beginners see signals as variables that update the UI.

Senior engineers see a graph.

Every computed is a node.

Every read is an edge.

Every effect is a place where the graph touches the outside world.

Before they write a signal, they ask:

  • What does this value depend on?
  • Who is allowed to change it?
  • What happens while it's loading?
  • What happens when it fails?
  • When does this subscription end?
  • Is this state, an event, or async data?

That is the real senior bar.

Not knowing the API.

Knowing which API owns which responsibility.

Final Thought

Angular signals look easy.

And at the API level, they are.

signal, computed, effect.

Three functions.

Ten minutes to learn.

But the hard part was never the syntax.

The hard part is deciding which primitive owns which job.

Computeds derive.

Effects reach outside.

Resources wait.

Streams remember every event.

Mix those roles, and the app still works.

It just works harder, leaks quietly, and breaks on the one request that fails.

Keep them separate, and most of the bugs in this post become impossible to write.

So here is a challenge for today:

Search your codebase for effect(.

Look for .set( inside.

Each one is a computed waiting to happen.

Which of these 13 have you already shipped? Tell me in the comments.

Up Next

Angular HTTP & API Calls — Why Most Apps Handle Data Wrong

Because resources fix how you load data.

They don't fix what you ask for.

Written by Cristian Sifuentes

Angular engineer · Frontend architect · AI-assisted systems thinker

Notas de publicación (no van en el post)

Tags: #angular #frontend #ai #webdev

Al pegarlo en dev.to:

  • Copia desde el subtítulo en itálica hasta la firma.
  • Arriba va la portada y el título como ## Angular Signals Look Easy — Until You Realize Most Signal Bugs Never Throw an Error.
  • Todos los snippets de TypeScript pasan tsc --strict contra @angular/core 22.3. El template con @if no lo revisa tsc.
  • El Up Next cumple lo que prometiste en el post de Angular Forms: Angular HTTP & API Calls.

Portada:

Wide 3:2 landscape blog cover (1536x1024), painted entirely in the style of Van Gogh's "The Starry Night": thick impasto, swirling brushstrokes, deep cobalt and navy night sky, a glowing golden moon with swirling halos in the upper right, and a city skyline with a tall spire and a bridge over a reflective river on the right side.

CENTER: head-and-shoulders portrait of the person in the attached reference photo, looking slightly upward with a calm, confident expression, painted with the same brushstrokes.

TOP LEFT: hand-lettered all-caps title in gold and cream, mixed sizes: "ANGULAR SIGNALS LOOK EASY — UNTIL YOU REALIZE MOST SIGNAL BUGS NEVER THROW AN ERROR", with a small gold badge below it: "ANGULAR 22 EDITION". Make "ANGULAR SIGNALS" and "NEVER THROW AN ERROR" the largest gold words; render the connector words smaller in teal and lilac.

Around the portrait, four semi-transparent dark navy panels with thin gold borders and gold all-caps monospace headings:
1. "DERIVED STATE": code "lowStockCount = computed(() => ...)". Italic caption: "If it can be derived, never copy it."
2. "EFFECTS": code "onCleanup(() => clearInterval(timer));". Italic caption: "Start it. Stop it."
3. "RESOURCES": code "params: ({ chain }) => chain(this.product)?.supplierId". Italic caption: "Async data has states."
4. "RXJS BOUNDARY": code "takeUntilDestroyed(this.destroyRef)". Italic caption: "State can skip values. Events can't."

BOTTOM RIGHT: a large italic gold quote with oversized quotation marks: "Signals don't fail loudly. They fail quietly."

Code uses a monospace font with syntax highlighting. Render every piece of text exactly as written, with correct spelling. No logos, no watermarks, no extra text.

Fuentes (consultadas el 23 nov 2026):

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.