[]previous and next page

Core

Codes of the table MESSAGES in @shadow-js/core/extend.

For agentsUpdated

Codes of the table MESSAGES in @shadow-js/core/extend.

NO_OWNER_EFFECT#

Warning. useEffect, useRenderEffect or onMount ran with no current owner. The effect still runs, but nothing can ever dispose it, so it leaks for the life of the page.

Why: effect creation at module level, or after an await, a timer or an event callback, where the owner is gone. Fix: create the effect inside a component or createRoot; after an await, restore the owner with runWithOwner (see ownership).

NO_OWNER_CLEANUP#

Warning. onCleanup(fn) ran with no current owner; fn is dropped and never runs. Fix: register cleanups inside a component, effect or createRoot, or inside runWithOwner(owner, ...) after an await.

NO_OWNER_ERROR#

Warning. onError(handler) ran with no current owner; the handler can never be reached. Fix: call it inside the scope whose errors it should handle, or use catchError(fn, handler), which creates the scope for you.

NO_OWNER_ID#

Error (ShadowError, thrown). useId() ran outside any owner. An id comes from the position in the owner tree, so without an owner no id exists that matches between server and client. Fix: call useId() in a component body or inside createRoot.

WRITE_IN_MEMO#

Error (ShadowError, development only). A signal or store was written while a useMemo (or a compiler-derived constant) was computing. A memo must be a pure function of its sources, because it may run at any time or not at all. The error is stored in the memo and thrown to whoever reads it.

Fix: compute the value instead of storing it elsewhere; if a write is a real side effect, do it in useEffect.

CYCLE_DETECTED#

Error (ShadowError). A memo read itself while it was running, directly or through another memo that had to recompute in the same pull. The error is stored in the memo and thrown to its readers. (Two memos that only depend on each other without recomputing inside one another read the previous value; the error appears when a computation re-enters one that is still running.)

Fix: a value that depends on its own previous value is not a derivation. Use the previous argument that useMemo passes to its function, or keep the accumulator in a signal.

INFINITE_LOOP#

Error (ShadowError, raised when the flush ends). Effects kept re-triggering each other for more than 1000 passes, so the flush was aborted and its queues cleared. Typically an effect writes a signal it also reads.

Fix: read the previous value untracked (the updater form set((n) => n + 1) does), derive with a memo, or write from an event handler. See scheduler.

FLUSH_IN_EFFECT#

Warning. flushSync() was called while a flush was already draining (inside an effect or a cleanup). The call is ignored apart from running its callback. Fix: remove the call. The flush that is running will process everything you write; if you need the DOM updated, read it in a later effect or after the flush.

RUN_WITH_DISPOSED_OWNER#

Warning. runWithOwner(owner, fn) received an owner that was already disposed. The callback runs without an owner, so anything it creates is not owned (and may trigger the NO_OWNER_* warnings). It happens when an async callback outlives the component that captured the owner. Fix: check owner.disposed before scheduling more work, or cancel the work in onCleanup.

DUPLICATE_CORE#

Defined, not raised. The catalog contains DUPLICATE_CORE ("More than one copy of @shadow-js/core is loaded. Signals created by one copy are invisible to the other."), but no code in 1.0.0 detects a second copy yet, so you will not see this message. The failure it describes does happen, and the symptom is distinctive: components render once and never update, with no warning.

Why: two copies of core each own their own tracking registers. A signal created by one copy and read in an effect of the other is a plain value to that effect. Typical causes are two versions of @shadow-js/core in node_modules, a bundler that inlines core into a library and also resolves it separately, or a pre-bundled dependency (optimizeDeps) next to the source copy.

Fix: make every package resolve one copy: npm ls @shadow-js/core must show a single version, deduplicated; in Vite add resolve.dedupe: ["@shadow-js/core", "@shadow-js/web"]; library packages must list core and web as peerDependencies.

CONTEXT_MISSING#

Error (ShadowError, thrown). useContext(context) found no provider above it and the context has no default value. There is no correct value to return. Fix: render the provider above the consumer, or give the context a default: createContext(defaultValue).

EACH_KEY_DUPLICATE#

Warning. Two items of a keyed list (<For key={...}> or mapArray with key) have the same key. The first copy owns the row; later copies get a fresh row on every update, so their state is lost. Fix: use a key that is unique in the list, normally a database id.

EFFECT_DEPS_IGNORED#

Warning. useEffect(fn, [deps]) was called with a React-style dependency array. ShadowJS tracks the signals the effect reads, so the array is ignored and the effect re-runs whenever any signal it reads changes. Fix: drop the array to track what the body reads, or use useEffect(deps, fn) to track only what deps reads.