Domma Reactive User Manual

Disposal and teardown

Updated by Darryl Waterhouse on 17 October 2026 1 min read

Disposal

An effect is a live node in the dependency graph, and dropping the DOM does not drop it. Every entry point returns something to tear down with, and you must call it:

Created by Torn down by
effect(fn) .dispose() on the returned Computation
compile(…) controller.destroy()
applyBindings(…) handle.dispose()
observable.subscribe(fn) the returned off(), or off.dispose()

handle.dispose() drops every effect, listener, list instance and marker it created, restores a hidden data-if element, and leaves the markup as it found it. Both are safe to call twice.

Own the whole lifecycle

A DOM binding handle only owns the bindings and effects it creates. An application also owns its manually created effects, subscriptions, timers and pending requests. Keep their handles alongside the DOM handle and release each when the screen is removed.

Removing an element from the DOM alone does not dispose a separately created effect. Make teardown part of the same application lifecycle that mounts the region.