Optimizing Change Detection with the Power of Signals# REACTIVITY
A system's ability to respond to changes in data or state automatically
# CHANGE DETECTION
There are situations where change detection can become a performance bottleneck
CHANGE DETECTION #
The component itself and its children are checked for changes only when they are marked as "dirty"
CHANGE DETECTION #
Monkey patches more than 250 browser APIs
NgZone tracks events from this APIs and schedules an AppRef.tick()
Challenges with Zone.js
A Signal is a wrapper around a value that notifies interested consumers when the value changes.
# Change Detection using Signals
# Change Detection using Signals
Dependency graph
Consumers represent reactive contexts
Producers represent entities that hold a value. Changes are tracked when the producer is accessed within a consumer's reactive context.
# Change Detection using Signals
When the value of the Signal changes
Views act as a consumer
# Change Detection using Signals
async VS signal
# Change Detection using Signals
Targeted and Global mode
Traversal always happens in one of two modes
Global / Targeted
OnPush + HasChildViewsToRefresh🚩"
Ditry+OnPush".
RefreshView🚩 flag.
OnPush + RefreshView🚩" component
# Change Detection using Signals
Targeted and Global mode
# Change Detection using Signals
Targeted and Global mode
Bibliography: