Advanced / Owner & Introspection

isDisposed

Returns true if the owner has been disposed (or marked zombie pending disposal). Pair with a captured owner to bail out of late callbacks whose surrounding component already unmounted.


Import

import { isDisposed } from "solid-js";

Type signature

function isDisposed(node: Owner): boolean;

Examples

function onSettleSafe(fn: () => void) {
const owner = getOwner();
queueMicrotask(() => {
if (owner && isDisposed(owner)) return; // component unmounted; skip
runWithOwner(owner, fn);
});
}
Last updated: 7/4/26, 6:21 PMEdit this pageReport an issue with this page