Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Nested effects are a way to manage the lifetime of related Angular effects—not a built-in Angular API or a general-purpose way to copy state. In Miha Mulec’s September 30, 2026, article, the nestedEffect helper from @mmstack/primitives/core associates effects created during a parent effect’s synchronous run with that parent run. When the parent reruns or is destroyed, its children are destroyed too.

This ownership pattern can help when an imperative object—such as a chart, editor, or connection—has several independently changing inputs. Use computed or linkedSignal for state derived from other signals; use effects to synchronize with imperative APIs. Nested effects become useful when that integration also needs separate update paths and a managed lifetime.

How do nested effects work in Angular?

Angular’s effect() creates a reactive computation whose dependencies are the signals read during its most recent run. A nested-effect helper adds an ownership relationship: a child created while a parent effect is running belongs to that parent run. If the parent runs again, the old run’s children are cleaned up and destroyed; if the parent is destroyed, its children are destroyed as well.

The helper described by Mulec is provided by @mmstack/primitives/core and re-exported by @mmstack/primitives. It is not an Angular built-in. Its purpose is to organize effect lifetimes, not to make effects synchronous or remove Angular’s scheduling behavior.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

What happens on each run

  1. The parent runs. It reads the signals that determine whether an imperative instance should exist and which stable configuration it needs.
  2. The helper opens a run frame. The simplified implementation records the injector and child effect references associated with this run.
  3. Nested effects are created. Each child can track its own signals and update one aspect of the existing instance.
  4. The parent run is invalidated or destroyed. Cleanup callbacks run and the children are destroyed. A new parent run can then create a fresh set of children.

Because ownership is attached to a particular run, a child from a branch that no longer executes is not kept alive. Conversely, parent dependencies should be chosen with care: any change that reruns the parent tears down and recreates all of its children.

How this differs from Angular’s effect lifetime

Angular effects require an injection context unless an injector is passed in the options. Angular distinguishes component effects, which run as part of Angular synchronization and are connected to component state, from root effects, which run as microtasks and have no component-tree connection. Those are Angular’s scheduling and cleanup contexts; nested ownership is an additional convention provided by the helper.

Angular effects run at least once, and dependencies are tracked dynamically from synchronous signal reads in each execution. Reads after an asynchronous boundary such as await are not tracked. The helper’s ownership frame likewise exists only during synchronous execution of the effect body. An effect created later in a timer callback will not automatically belong to the earlier frame; it needs an appropriate injector or injection context.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

When to use nested effects—and when not to

First decide whether the value belongs in the signal graph or must be sent to an imperative system. Angular recommends computed() for read-only derived values and linkedSignal() when a derived value also needs to be manually writable. An effect is appropriate when synchronizing with a non-signal API such as a charting library, editor, canvas, storage, or logging.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Need Prefer Why
Derive a read-only value from signals computed() The value remains part of the reactive state graph rather than being copied into another signal by an effect.
Derive a value that can also be set manually linkedSignal() It models derived but writable state directly.
Send one changing value to an imperative library A plain effect() A child lifetime may add unnecessary structure. Mulec puts it simply: “For a single value passed to a library I’d still use a plain effect.”
Manage several independent updates to one imperative instance A parent effect with nested child effects The parent controls instance lifetime; children independently synchronize settings or data.

Nested effects do not automatically improve performance. Their value is clearer ownership and the ability to keep a frequent update from reapplying unrelated settings. The cost and benefit still depend on the integrated library and how its instance is created and updated.

Example: separate connection setup from outgoing messages

A connection is a useful case because it has both relatively stable setup and frequently changing work. A parent can depend on an enabled flag and URL, create the connection, and establish cleanup. A nested child can watch outgoing messages and send them through that connection.

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
  • When the enabled state or URL changes, the parent run is replaced, along with its children.
  • When only outgoing messages change, the child sends them through the existing connection; the parent does not need to reconnect.
  • When disabling or replacing the connection, destroy the child before closing the old connection if the child’s cleanup may still use it.

This pattern is useful only if the parent’s dependencies are genuinely stable relative to the child’s. If a high-frequency signal is read by the parent, every update will cause the setup and all child effects to be recreated.

Example: isolate chart data, theme, and locale updates

A chart wrapper can use a parent effect to create a chart for a particular container and configuration. Separate child effects can then synchronize theme, locale, and data. A streaming data update can update just the chart data instead of reapplying theme and locale settings.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If the container changes, the parent’s instance lifetime changes too: dispose the children and old chart, then create replacements for the new container. Cleanup ordering matters whenever child cleanup uses the chart or another resource owned by the parent. The child should be destroyed before that resource is disposed.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Example: editor, selected model, and language

Mulec’s Monaco editor example uses more than one ownership level. An outer effect creates the editor; a child responds to the selected text model; a nested child updates that model’s language. When the selected model changes, the language effect can be replaced without recreating the whole editor. Destroying the editor’s scope cleans up descendants.

The editor view and the text model need not share the same ownership. A model may be shared by multiple editor instances, so disposing one editor should not dispose a model that another editor still uses. The caller that owns the shared model remains responsible for its lifetime.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Mapped arrays need an explicit owner when lifetimes diverge

Lazy mapping introduces a subtle ownership risk. If a mapped row’s effect is created while another effect happens to read the mapper, that reader can accidentally become the row effect’s owner. Should the reader rerun while the mapped entry remains stable, its cleanup may destroy the row’s update effect even though the mapper does not recreate that row.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Mulec’s library supports selecting an explicit owner for such effects. Keying entries by identity is useful when a widget should follow an item as it moves through reordering; positional mapping instead follows slots. The appropriate choice depends on whether the external widget represents an item or a position.

Pause an effect without tracking skipped work

A pause signal can be checked before reading signals used by the effect’s normal work:

effect(() => {
  if (paused()) return;

  // Read signals and synchronize the imperative API here.
});

While paused, the effect tracks paused but not the signals in the skipped section. Turning pause off invalidates the effect, which runs the work again and establishes those dependencies anew. This is different from continuing to read every input and merely ignoring its value.

Implementation details and practical limits

The article’s simplified helper maintains a stack of frames. A frame contains an injector and a set of child EffectRefs. When nestedEffect is called inside an active frame, it creates the child effect under that injector and wraps child construction with untracked, so setup reads do not inadvertently become dependencies of the parent.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Each parent execution gets a fresh frame. Its cleanup invokes registered user cleanup callbacks and then destroys its child effects. Top-level effects rely on Angular’s injector cleanup; for nested effects, the helper takes responsibility for child disposal. The package’s production implementation adds effect options, explicit frame ownership, repeated-destroy protection, and guarded cleanup callbacks; those safeguards should not be assumed to exist in the simplified illustration.

  • Keep setup dependencies narrow. Parent dependencies determine when the entire child set is rebuilt.
  • Order cleanup deliberately. Destroy children before closing a connection or disposing an instance they may use.
  • Respect synchronous tracking. Read signal dependencies before asynchronous boundaries, and do not expect a delayed effect creation to inherit an earlier ownership frame.
  • Use untracked deliberately. It is appropriate for incidental reads that should not make an effect depend on them; it is not a replacement for choosing the right state model.
  • For DOM timing, choose the right Angular API. Angular documents afterRenderEffect for integrations that must inspect or modify the DOM after Angular has rendered.

Further reading

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.