API reference · generated from source
Class: QueryNode<TArgs, TState>#
Defined in: retree-query/src/QueryNode.ts:57
Backend-agnostic reactive query node that subscribes to an async source and writes emitted values into Retree state.
Remarks#
The node owns the full async-query state machine:
- Status/result:
pending,success(optionallyisStalewithkeepPreviousData),error, andskipped. - Subscription lifecycle: the source is subscribed when the node gains its first Retree observer and disposed when it loses its last one; disposal is sticky until the node is observed again (or QueryNode.retry runs after an error).
- Args lifecycle: QueryNode.updateArgs resubscribes only when arguments change under deep comparison.
- Optimistic updates: QueryNode.optimisticUpdate applies local transforms with generation tracking and rejection-time baseline rollback.
- Reconciliation: an optional IStateReconciler keeps object identity stable across emissions.
Backends plug in through IQuerySubscriptionSource. Subclasses (for
example ConvexQueryNode in @retreejs/convex) bind a concrete client and
may override the protected hooks (tryDefaultReconcile, cloneState,
stateEquals, restoreState) for backend-specific state shapes.
Example#
const node = Retree.root(
new QueryNode(mySource, { args: { listId: "today" } })
);
Retree.on(node, "nodeChanged", (next) => {
console.log(next.result.status);
});Extends#
ReactiveNode
Type Parameters#
| Type Parameter |
|---|
TArgs |
TState |
Constructors#
Constructor#
new QueryNode<TArgs, TState>(source, options): QueryNode<TArgs, TState>;Defined in: retree-query/src/QueryNode.ts:142
Create a node for an async query subscription.
Parameters#
| Parameter | Type | Description |
|---|---|---|
source | IQuerySubscriptionSource<TArgs, TState> | Backend subscription source. |
options | | "skip" | IQueryNodeOptions<TArgs, TState> | Query arguments, optional initial state, and optional reconciler — or "skip" to start disabled. |
Returns#
QueryNode<TArgs, TState>
Remarks#
The subscription starts when the node is observed by Retree. This avoids opening backend subscriptions for state nobody is currently rendering or listening to.
Example#
const node = Retree.root(
new QueryNode(mySource, {
args: { listId: "today" },
initialState: [],
})
);Overrides#
ReactiveNode.constructorProperties#
| Property | Modifier | Type | Default value | Description | Inherited from | Defined in |
|---|---|---|---|---|---|---|
error | public | Error | null | null | Latest subscription or mutation rollback error. | - | retree-query/src/QueryNode.ts:90 |
options | public | IRetreeNodeOptions | undefined | Runtime options for this Retree node. Remarks Retree ignores this field for reactivity so options do not emit or become part of the tree. | ReactiveNode.options | retree-core/bin/ReactiveNode.d.ts:109 |
result | public | QueryNodeResult<TState> | undefined | Latest structured query result. | - | retree-query/src/QueryNode.ts:86 |
RETREE_LINKED_KEYS_SYMBOL | public | Set<string | symbol> | undefined | - | ReactiveNode.RETREE_LINKED_KEYS_SYMBOL | retree-core/bin/ReactiveNode.d.ts:101 |
RETREE_SELECT_GETTERS_SYMBOL | public | Map<string | symbol, IReactiveSelectGetter<ReactiveNode, unknown>> | undefined | - | ReactiveNode.RETREE_SELECT_GETTERS_SYMBOL | retree-core/bin/ReactiveNode.d.ts:102 |
state | public | TState | undefined | undefined | Latest query state emitted by the source, or the initial state before the source emits. | - | retree-query/src/QueryNode.ts:82 |
Accessors#
dependencies#
Get Signature#
get dependencies(): never[];Defined in: retree-query/src/QueryNode.ts:157
Dependencies to listen for changes to.
Remarks
When any IReactiveDependency criteria is met, a change will be emitted for this ReactiveNode instance.
Defaults to [] (no dependencies). Subclasses only override this
getter when the node should emit for changes to other nodes; plain
state classes need no dependencies boilerplate.
Keep this getter deterministic. Do not start subscriptions, perform network work, or mutate state here. Use ReactiveNode.onObserved, ReactiveNode.onUnobserved, and ReactiveNode.onChanged for lifecycle work.
The returned array may change length or ordering while the node is
observed. Retree treats added, removed, or reordered entries as
invalidation and refreshes subscriptions. Use null when you want an
inactive slot to keep its position, but it is not required for
correctness.
Example
class ProjectSummary extends ReactiveNode {
public tasks: { done: boolean }[] = [];
get doneCount() {
return this.tasks.filter((task) => task.done).length;
}
get dependencies() {
return [this.dependency(this.tasks, [this.doneCount])];
}
}Returns
never[]
Overrides#
ReactiveNode.dependenciesqueryNodeName#
Get Signature#
get protected queryNodeName(): string;Defined in: retree-query/src/QueryNode.ts:165
Name used in error and warning messages so failures pinpoint the concrete node class. Subclasses override this with their class name.
Returns
string
Methods#
cloneState()#
protected cloneState(state): TState | undefined;Defined in: retree-query/src/QueryNode.ts:593
Clone a state value for optimistic rollback baselines.
Parameters#
| Parameter | Type |
|---|---|
state | TState | undefined |
Returns#
TState | undefined
Remarks#
The base implementation uses structuredClone over the raw view, which
supports every structured-cloneable value including bigint and
ArrayBuffer. Subclasses whose state carries non-cloneable members
(such as functions) override this.
dependency()#
Call Signature#
dependency<TNode>(node, comparisons?): IReactiveDependency<TNode>;Defined in: retree-core/bin/ReactiveNode.d.ts:413
Creates a new IReactiveDependency instance.
Type Parameters
| Type Parameter | Default type |
|---|---|
TNode extends object | object |
Parameters
| Parameter | Type | Description |
|---|---|---|
node | OptionalNode<TNode> | the node to listen to "nodeChanged" events for. |
comparisons? | any[] | Optional. Values to compare between updates to node. |
Returns
IReactiveDependency<TNode>
dependency object.
Remarks
Use this inside the ReactiveNode.dependencies getter or an
@select dependency selector when one slot needs explicit comparison
cells. If node is a Retree-managed object, it is observed with
nodeChanged. If node is a primitive or unproxied value, Retree
treats it as a comparison-only dependency.
Comparison cells should be deterministic. If their length/order changes,
Retree treats that as invalidation and emits for this node. If no
comparisons are provided, every nodeChanged event from the dependency
emits for this node.
Example
get dependencies() {
return [
this.authStore,
this.authStore.session?.userId,
this.dependency(this.selectedProject ?? null, [this.projectId]),
];
}Inherited from
ReactiveNode.dependencyCall Signature#
dependency<TValue>(value): IReactiveDependency;Defined in: retree-core/bin/ReactiveNode.d.ts:414
Creates a new IReactiveDependency instance.
Type Parameters
| Type Parameter |
|---|
TValue |
Parameters
| Parameter | Type |
|---|---|
value | TValue |
Returns
IReactiveDependency
dependency object.
Remarks
Use this inside the ReactiveNode.dependencies getter or an
@select dependency selector when one slot needs explicit comparison
cells. If node is a Retree-managed object, it is observed with
nodeChanged. If node is a primitive or unproxied value, Retree
treats it as a comparison-only dependency.
Comparison cells should be deterministic. If their length/order changes,
Retree treats that as invalidation and emits for this node. If no
comparisons are provided, every nodeChanged event from the dependency
emits for this node.
Example
get dependencies() {
return [
this.authStore,
this.authStore.session?.userId,
this.dependency(this.selectedProject ?? null, [this.projectId]),
];
}Inherited from
ReactiveNode.dependencydispose()#
dispose(): void;Defined in: retree-query/src/QueryNode.ts:564
Stop the active backend subscription.
Returns#
void
Remarks#
Retree calls this automatically when the node loses its last active
observer. Call it manually when tearing the owner down outside Retree
observation. Disposing stops future backend updates; it does not clear
state, result, or error.
Disposal is sticky: writes to the node no longer reopen the subscription. The node resubscribes when it gains a new observer, or when QueryNode.retry runs after an error.
link()#
link<TNode>(node): RetreeLink<TNode>;Defined in: retree-core/bin/ReactiveNode.d.ts:167
Create a reactive pointer to an existing Retree-managed node.
Type Parameters#
| Type Parameter |
|---|
TNode extends object |
Parameters#
| Parameter | Type | Description |
|---|---|---|
node | TNode | Existing Retree-managed node to point at. |
Returns#
RetreeLink<TNode>
A Retree-managed RetreeLink whose current points at node.
Remarks#
This is a convenience wrapper around Retree.link. Use it when a
ReactiveNode method needs to return or store a pointer to a node owned
elsewhere without reparenting that node.
Do not use link when ownership should move; use Retree.move or
ReactiveNode.moveTo. Do not use it when two locations need
independent state; use Retree.clone.
Example#
class EditorState extends ReactiveNode {
public selected = null as RetreeLink<Task> | null;
public select(task: Task) {
this.selected = this.link(task);
}
}Inherited from#
ReactiveNode.linkmemo()#
Call Signature#
protected memo<T>(fn, comparisons?): T;Defined in: retree-core/bin/ReactiveNode.d.ts:486
Memoize the result of fn, scoped to this ReactiveNode instance.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
fn | () => T |
comparisons? | unknown[] |
Returns
T
Remarks
Two forms:
- Keyless (inside a getter):
this.memo(fn, deps?)— derives the cache key from the active getter's property name. Throws if called outside a getter or more than once in the same getter. - Explicit key:
this.memo(key, fn, deps?)— works anywhere; required when stacking multiple memo cells in one getter, or memoizing inside a method.
Cache semantics for comparisons:
- Omitted/
undefined: runfnunder automatic dependency trapping and recompute when one of the trapped reads changes. []: compute once and cache forever for this instance.[a, b, ...]: recompute when any cell shallow-changes usingObject.is. Tree-node cells are compared by their latest reproxy identity, so passingthis.listcorrectly invalidates whenlistmutates.
memo is a cache, not a subscription. It does not emit
nodeChanged or trigger React renders by itself. Pair it with
dependencies, Retree.select, or useSelect when you also need
notification behavior.
Example
class ListFilter extends ReactiveNode {
list: Card[] = [];
searchText = "";
// Keyless form
get filteredList() {
return this.memo(
() => this.list.filter((c) => c.text === this.searchText),
[this.list, this.searchText]
);
}
// Explicit-key form (e.g. when stacking two memos in one getter)
get pair() {
const a = this.memo("a", () => expensiveA(), [this.list]);
const b = this.memo("b", () => expensiveB(), [this.searchText]);
return { a, b };
}
get dependencies() { return [this.dependency(this.list)]; }
}Inherited from
ReactiveNode.memoCall Signature#
protected memo<T>(
key,
fn,
comparisons?): T;Defined in: retree-core/bin/ReactiveNode.d.ts:487
Memoize the result of fn, scoped to this ReactiveNode instance.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type |
|---|---|
key | string |
fn | () => T |
comparisons? | unknown[] |
Returns
T
Remarks
Two forms:
- Keyless (inside a getter):
this.memo(fn, deps?)— derives the cache key from the active getter's property name. Throws if called outside a getter or more than once in the same getter. - Explicit key:
this.memo(key, fn, deps?)— works anywhere; required when stacking multiple memo cells in one getter, or memoizing inside a method.
Cache semantics for comparisons:
- Omitted/
undefined: runfnunder automatic dependency trapping and recompute when one of the trapped reads changes. []: compute once and cache forever for this instance.[a, b, ...]: recompute when any cell shallow-changes usingObject.is. Tree-node cells are compared by their latest reproxy identity, so passingthis.listcorrectly invalidates whenlistmutates.
memo is a cache, not a subscription. It does not emit
nodeChanged or trigger React renders by itself. Pair it with
dependencies, Retree.select, or useSelect when you also need
notification behavior.
Example
class ListFilter extends ReactiveNode {
list: Card[] = [];
searchText = "";
// Keyless form
get filteredList() {
return this.memo(
() => this.list.filter((c) => c.text === this.searchText),
[this.list, this.searchText]
);
}
// Explicit-key form (e.g. when stacking two memos in one getter)
get pair() {
const a = this.memo("a", () => expensiveA(), [this.list]);
const b = this.memo("b", () => expensiveB(), [this.searchText]);
return { a, b };
}
get dependencies() { return [this.dependency(this.list)]; }
}Inherited from
ReactiveNode.memomoveTo()#
Call Signature#
moveTo<TValue>(destination, key?): this;Defined in: retree-core/bin/ReactiveNode.d.ts:137
Move this node to a new structural parent.
Type Parameters
| Type Parameter | Default type |
|---|---|
TValue extends object | QueryNode<TArgs, TState> |
Parameters
| Parameter | Type | Description |
|---|---|---|
destination | QueryNode<TArgs, TState> extends TValue ? TValue[] : never | Retree-managed destination collection or object. |
key? | number | Optional array insertion index, map key, or object property key. |
Returns
this
The latest reproxy for this node after it moves.
Remarks
This is a convenience wrapper around Retree.move. Use it from instance methods when a node should transfer ownership to another Retree-managed array, map, set, or object.
Do not call moveTo on a root node; roots have no parent to remove from.
Do not manually remove the node from its current parent before moving.
Example
class Task extends ReactiveNode {
public title = "";
public complete(done: Task[]) {
this.moveTo(done); // same as Retree.move(this, done)
}
}Inherited from
ReactiveNode.moveToCall Signature#
moveTo<TKey, TValue>(destination, key): this;Defined in: retree-core/bin/ReactiveNode.d.ts:138
Move this node to a new structural parent.
Type Parameters
| Type Parameter | Default type |
|---|---|
TKey | unknown |
TValue extends object | QueryNode<TArgs, TState> |
Parameters
| Parameter | Type | Description |
|---|---|---|
destination | QueryNode<TArgs, TState> extends TValue ? Map<TKey, TValue> : never | Retree-managed destination collection or object. |
key | TKey | Optional array insertion index, map key, or object property key. |
Returns
this
The latest reproxy for this node after it moves.
Remarks
This is a convenience wrapper around Retree.move. Use it from instance methods when a node should transfer ownership to another Retree-managed array, map, set, or object.
Do not call moveTo on a root node; roots have no parent to remove from.
Do not manually remove the node from its current parent before moving.
Example
class Task extends ReactiveNode {
public title = "";
public complete(done: Task[]) {
this.moveTo(done); // same as Retree.move(this, done)
}
}Inherited from
ReactiveNode.moveToCall Signature#
moveTo<TValue>(destination): this;Defined in: retree-core/bin/ReactiveNode.d.ts:139
Move this node to a new structural parent.
Type Parameters
| Type Parameter | Default type |
|---|---|
TValue extends object | QueryNode<TArgs, TState> |
Parameters
| Parameter | Type | Description |
|---|---|---|
destination | QueryNode<TArgs, TState> extends TValue ? Set<TValue> : never | Retree-managed destination collection or object. |
Returns
this
The latest reproxy for this node after it moves.
Remarks
This is a convenience wrapper around Retree.move. Use it from instance methods when a node should transfer ownership to another Retree-managed array, map, set, or object.
Do not call moveTo on a root node; roots have no parent to remove from.
Do not manually remove the node from its current parent before moving.
Example
class Task extends ReactiveNode {
public title = "";
public complete(done: Task[]) {
this.moveTo(done); // same as Retree.move(this, done)
}
}Inherited from
ReactiveNode.moveToCall Signature#
moveTo<TDestination>(destination, key): this;Defined in: retree-core/bin/ReactiveNode.d.ts:140
Move this node to a new structural parent.
Type Parameters
| Type Parameter | Default type |
|---|---|
TDestination extends object | object |
Parameters
| Parameter | Type | Description |
|---|---|---|
destination | TDestination | Retree-managed destination collection or object. |
key | RetreeObjectMoveKey<TDestination, QueryNode<TArgs, TState>> | Optional array insertion index, map key, or object property key. |
Returns
this
The latest reproxy for this node after it moves.
Remarks
This is a convenience wrapper around Retree.move. Use it from instance methods when a node should transfer ownership to another Retree-managed array, map, set, or object.
Do not call moveTo on a root node; roots have no parent to remove from.
Do not manually remove the node from its current parent before moving.
Example
class Task extends ReactiveNode {
public title = "";
public complete(done: Task[]) {
this.moveTo(done); // same as Retree.move(this, done)
}
}Inherited from
ReactiveNode.moveToonChanged()#
protected onChanged(): void;Defined in: retree-query/src/QueryNode.ts:177
Runs after this ReactiveNode receives a fresh reproxy.
Returns#
void
Remarks#
Override this when a node needs to synchronize derived state only after a
real Retree change. Retree runs this before nodeChanged /
treeChanged listeners flush. If no transaction is already active,
Retree starts one so state updates made here are batched with the reproxy
that triggered the effect.
Use this for small synchronization writes that should happen only after Retree has confirmed a real change. Avoid writing unconditionally here; guard against loops by checking whether the derived value actually changed.
Example#
class SearchState extends ReactiveNode {
public query = "";
public normalizedQuery = "";
protected onChanged() {
const next = this.query.trim().toLowerCase();
if (this.normalizedQuery !== next) {
this.normalizedQuery = next;
}
}
}Overrides#
ReactiveNode.onChangedonObserved()#
protected onObserved(): void;Defined in: retree-query/src/QueryNode.ts:169
Runs when this ReactiveNode gets its first active
nodeChanged or treeChanged observer.
Returns#
void
Remarks#
Override this for work that requires the proxied instance, such as starting external subscriptions that write back into Retree state.
Keep setup idempotent. Retree calls this when the first active
nodeChanged or treeChanged listener starts observing the node, not
when the node is constructed.
Example#
class LiveValue extends ReactiveNode {
public value = "";
@ignore private unsubscribe: (() => void) | null = null;
protected onObserved() {
this.unsubscribe = subscribe((value) => {
this.value = value; // ✅ emits through Retree
});
}
}Overrides#
ReactiveNode.onObservedonUnobserved()#
protected onUnobserved(): void;Defined in: retree-query/src/QueryNode.ts:181
Runs when this ReactiveNode loses its last active
nodeChanged or treeChanged observer.
Returns#
void
Remarks#
Use this to clean up resources created in ReactiveNode.onObserved. Do not rely on it as a destructor for unobserved nodes; it only runs after observation had started.
Example#
protected onUnobserved() {
this.unsubscribe?.();
this.unsubscribe = null;
}Overrides#
ReactiveNode.onUnobservedoptimisticUpdate()#
optimisticUpdate(transform): void;Defined in: retree-query/src/QueryNode.ts:348
Apply an optimistic update. If a mutation context is provided, rollback when its promise rejects unless a newer server value resolves the dirty state first.
Parameters#
| Parameter | Type | Description |
|---|---|---|
transform | IOptimisticQueryTransform<TState> | Optimistic transform and optional mutation context. |
Returns#
void
Remarks#
Use this when the UI should update immediately before the backend confirms the write. The transform mutates the existing query state in place and emits through Retree.
Prefer small, targeted transforms. Provide revert(...) when the default
rollback to the last clean server value is not specific enough.
Example#
node.optimisticUpdate({
ctx: { promise: mutationPromise },
apply(tasks) {
const task = tasks.find((item) => item.id === taskId);
if (task) task.isCompleted = !task.isCompleted;
},
});peekInto()#
peekInto<TResult>(fn): TResult;Defined in: retree-core/bin/ReactiveNode.d.ts:259
Run a read-only query against this node's raw object at native speed, then resolve the result back to its Retree-managed node when one exists.
Type Parameters#
| Type Parameter |
|---|
TResult |
Parameters#
| Parameter | Type | Description |
|---|---|---|
fn | (raw) => TResult | Read-only callback that receives the raw object behind this node. |
Returns#
TResult
The callback result, resolved to its managed node when one exists.
Remarks#
This is a convenience wrapper around Retree.peekInto for
this. The callback receives the raw object behind this node
(ReactiveNode.raw), so reads inside it skip proxy traps and are
not tracked as dependencies. If the returned value is an object that
belongs to a Retree tree, the latest managed node (reproxy or base
proxy) is returned instead; primitives and unmanaged objects are
returned as-is.
Only the returned value itself is resolved. Containers built inside the
callback (for example filter results) are returned unchanged, with
raw elements. Children that have never been read through the managed
tree have no proxy yet and resolve to their raw value; traverse the
path once, or use prepareTree / autoPrepare, when a managed result
is required.
Example#
class TaskList extends ReactiveNode {
public tasks: Task[] = [];
get dependencies() {
return [this.dependency(this.tasks)];
}
public findTask(id: string): Task | undefined {
// Scans raw at native speed; returns the managed task node.
return this.peekInto((raw) =>
raw.tasks.find((task) => task.id === id)
);
}
}Inherited from#
ReactiveNode.peekIntoprepareTree()#
prepareTree(options?): void;Defined in: retree-core/bin/ReactiveNode.d.ts:440
Prepare lazy Retree child proxies below this ReactiveNode.
Parameters#
| Parameter | Type | Description |
|---|---|---|
options? | IRetreePrepareTreeOptions | Optional depth limit. Omit to prepare all reachable non-ignored child objects. |
Returns#
void
Remarks#
Retree lazily proxies plain object and array fields on ReactiveNodes. Call
this when an app wants to pay that first-touch cost during a controlled
phase, such as while showing a loading spinner. This walks only own data
properties, so computed getters like dependencies are not evaluated or
cached as child nodes. Fields marked with @ignore are skipped.
Do not call this for every render. Call it once during setup, loading, or before a known interaction that will traverse a large subtree.
Example#
class LargeNode extends ReactiveNode {
public sections = [{ title: "Intro", cards: [] }];
}
const node = Retree.root(new LargeNode());
node.prepareTree({ depth: 1 });Inherited from#
ReactiveNode.prepareTreeraw()#
raw(): this;Defined in: retree-core/bin/ReactiveNode.d.ts:201
Get the raw, unproxied object behind this node for read-only, non-reactive access.
Returns#
this
The raw object behind this node.
Remarks#
This is a convenience wrapper around Retree.raw for this.
Reads on the returned object skip proxy traps entirely, so algorithms
that scan large collections owned by this node can run at native speed.
Treat the result as read-only: direct mutations skip Retree change
emission. Reads are invisible to reactivity, including this node's own
auto-trapped @memo / @select dependency collection. Throws when the
node is not yet Retree-managed (for example inside the constructor,
before Retree.root(...) or tree attachment).
Example#
class Leaderboard extends ReactiveNode {
public scores: number[] = [];
get dependencies() {
return [this.dependency(this.scores)];
}
get total() {
// Raw scan; reactivity comes from `dependencies`.
return this.raw().scores.reduce((sum, s) => sum + s, 0);
}
}Inherited from#
ReactiveNode.rawrestoreState()#
protected restoreState(next): void;Defined in: retree-query/src/QueryNode.ts:511
Write an emitted or rollback value into state.
Parameters#
| Parameter | Type |
|---|---|
next | TState | undefined |
Returns#
void
Remarks#
Applies the configured IStateReconciler when one exists,
otherwise gives QueryNode.tryDefaultReconcile a chance before
replacing the state wholesale. Subclasses with non-plain state shapes
(for example paginated results carrying a loadMore function) override
this.
retry()#
retry(): void;Defined in: retree-query/src/QueryNode.ts:235
Re-subscribe to the query after result.status is "error".
Returns#
void
Remarks#
Use this from retry affordances in UI. It closes the errored
subscription and opens a fresh one with the current args, moving the
result to "pending" (or the cached value when the backend has one).
Does nothing unless the current status is "error".
Example#
if (node.result.status === "error") {
node.retry(); // ✅ re-opens the subscription
}stateEquals()#
protected stateEquals(left, right): boolean;Defined in: retree-query/src/QueryNode.ts:657
Compare an incoming emission against the last clean baseline.
Parameters#
| Parameter | Type |
|---|---|
left | TState | undefined |
right | TState | undefined |
Returns#
boolean
Remarks#
The base implementation is a deep structural compare. Subclasses whose
state carries members that churn identity without meaning (such as a
loadMore function) override this.
tryDefaultReconcile()#
protected tryDefaultReconcile(_next): boolean;Defined in: retree-query/src/QueryNode.ts:547
Backend-convention reconciliation used when no explicit reconciler was
configured. Return true when next was reconciled into the current
state in place. The base implementation performs no reconciliation.
Parameters#
| Parameter | Type |
|---|---|
_next | TState |
Returns#
boolean
untracked()#
untracked<T>(fn): T;Defined in: retree-core/bin/ReactiveNode.d.ts:214
Run a synchronous function with Retree dependency tracking paused.
Type Parameters#
| Type Parameter |
|---|
T |
Parameters#
| Parameter | Type | Description |
|---|---|---|
fn | () => T | Function to run without dependency tracking. |
Returns#
T
The function's return value.
Remarks#
This is a convenience wrapper around Retree.untracked. Use it
inside auto-trapped @memo, @fnMemo, and @select bodies when bulk
reads should not become dependencies. Reads still go through Retree
proxies; writes still emit normally.
Inherited from#
ReactiveNode.untrackedupdateArgs()#
updateArgs(args): void;Defined in: retree-query/src/QueryNode.ts:214
Update the query arguments and resubscribe when the arguments change (compared deeply).
Parameters#
| Parameter | Type | Description |
|---|---|---|
args | TArgs | "skip" | Next query arguments, or "skip" to disable the subscription. |
Returns#
void
Remarks#
Use this when query args are controlled by Retree state, routing, or user
input. Passing "skip" disables the active subscription and sets
result.status to "skipped".
Updating args can emit because state, result, and error may change.
When the node was constructed with keepPreviousData, the previous
state stays visible while the new subscription loads and
result.isStale is true until the first value arrives.
On a disposed node this records the new args without opening a subscription; the node resubscribes with the latest args when it is observed again.
Example#
node.updateArgs({ listId: "tomorrow" }); // ✅ may emit pending/success
node.updateArgs("skip"); // ✅ emits skipped state and unsubscribes