Skip to content

@jsvision/ui / ReactiveCycleError

Class: ReactiveCycleError

Defined in: ui/src/reactive/errors.ts:29

Thrown when reactive propagation fails to settle within its fixed iteration limit — almost always because an effect writes a signal it also depends on, creating an update loop that never converges. Throwing (rather than looping forever) hands control back to the caller so the app never hangs. When you see this, look for an effect that both reads and writes the same signal.

Example

ts
import { ReactiveCycleError, signal, effect, createRoot } from '@jsvision/ui';

try {
  createRoot(() => {
    const n = signal(0);
    effect(() => n.set(n() + 1)); // reads AND writes n → never converges
  });
} catch (err) {
  if (err instanceof ReactiveCycleError) {
    console.error('reactive loop; hit', err.iterationLimit, 'iterations');
  }
}

Extends

  • TuiError

Constructors

Constructor

new ReactiveCycleError(iterationLimit, detail?): ReactiveCycleError

Defined in: ui/src/reactive/errors.ts:38

Parameters

iterationLimit

number

The propagation-iteration limit that was exceeded.

detail?

string

Optional message override for a computed-dependency cycle; when omitted, the default effect-write-loop message is used.

Returns

ReactiveCycleError

Overrides

TuiError.constructor

Properties

iterationLimit

readonly iterationLimit: number

Defined in: ui/src/reactive/errors.ts:31

The propagation-iteration limit that was hit before giving up.