Advanced

Observation by data type

How rs-x observes value changes differently per runtime type (descriptor patching, proxies, or async observers).

Change detection by value type

rs-x selects the observation strategy per runtime value type. The table below summarizes how mutation is detected and pushed into the state/change pipeline.

Recursive member observation is opt-in via IIndexWatchRule, passed either to state manager watchState(...) or as leafIndexWatchRule in rsx(...). The rule is evaluated per (index, target); when it returns true, rs-x installs nested observers/proxies and rebinds them if a member value is replaced. Without a watch rule, only root assignments/mutations are observed.

rs-x does not set up observation again on every bind. For the same observed target, it reuses the existing observation setup and tracks usage with reference counting. New binds increment the count; dispose/unbind decrements it; when the count reaches zero, rs-x tears down observation, restores patched descriptors, and writes proxified property values back to their raw (unproxified) value.

ArrayProxyFalseArray mutations emit index-level changes; with IndexWatchRule, matching items are observed recursively.
DateProxyFalseDate setter calls emit date-part changes; with IndexWatchRule, only matching date properties are emitted.
Expression (AbstractExpression)Observer (changed event)TrueWhen an expression value changes, the change flows through state manager so dependent expressions re-evaluate.
MapProxyFalseMap mutations emit key-level changes; with IndexWatchRule, matching entry values are observed recursively.
ObservableObserver (subscribe)TrueEach observable emission updates the stored value, and the change flows through state manager.
Plain object propertyPatchingFalseProperty writes hit patched descriptors and emit changes; with IndexWatchRule, matching nested members are observed recursively.
PromiseObserver (then)TrueWhen a promise resolves, the resolved value is stored and the change flows through state manager.
SetProxyFalseSet membership mutations emit member-level changes; with IndexWatchRule, matching members are observed recursively.