untracked()

Reads signals without registering them as reactive dependencies.

Since Angular 16+ Spec ↗

Syntax

untracked<T>(fn: () => T): T

Parameters

NameTypeRequiredDescription
fn () => T No Function whose signal reads should not be tracked.

Returns

T — The return value of the supplied function.

Examples

import { signal, effect, untracked } from '@angular/core';

const value = signal(0);
const logCount = signal(0);

effect(() => {
  console.log('value:', value());
  untracked(() => logCount.set(logCount() + 1));
});

Notes

Use untracked inside computed or effect when you need to read a signal's current value without making it a dependency, preventing unnecessary re-execution. Common for logging, reading config, or writing to a signal derived from another without creating a loop.