Reads and writes to the ignored field still work normally, but:
this.ignored.count = 1) do not emit
nodeChanged / treeChanged listeners on the parent.this.ignored = {...}) likewise
skips listener emission.Use this for state that lives on a ReactiveNode but should not participate in
the tree — caches, scratch buffers, framework handles, references to objects
already managed elsewhere, etc.
import { Retree, ReactiveNode, ignore } from "@retreejs/core";
class Counter extends ReactiveNode {
public count = 0;
// Mutations to `cache` do not trigger Retree listeners.
@ignore public cache: Record<string, unknown> = {};
get dependencies() { return []; }
}
const node = Retree.root(new Counter());
Retree.on(node, "nodeChanged", () => console.log("changed"));
node.cache.something = 1; // ❌ no log
node.count = 1; // ✅ logs "changed"
Field decorator that excludes a property of a ReactiveNode from Retree's reactivity system.