{
  "id": "713623e78b38920e85ff988f",
  "source": "solid:signals",
  "type": "github-document",
  "title": "get-owner",
  "content": "---\ntitle: getOwner\nuse_cases: \u003e-\n  advanced tracking control, custom cleanup logic, understanding component\n  hierarchy, debugging ownership chains, manual scope management\ntags:\n  - ownership\n  - tracking\n  - scopes\n  - cleanup\n  - debugging\nversion: '1.0'\ndescription: \u003e-\n  Access the current tracking scope owner in SolidJS for advanced control over\n  cleanup and disposal. Essential for custom reactive primitives.\n---\n\n```tsx\nimport { getOwner } from \"solid-js\"\nimport type { Owner } from \"solid-js\"\n\nfunction getOwner(): Owner\n\n```\n\nGets the tracking scope that owns the currently running code, e.g., for passing into a later call to `runWithOwner` outside of the current scope.\n\nInternally, computations (effects, memos, etc.) create owners which are children of their owner, all the way up to the root owner created by `createRoot` or `render`.\nIn particular, this ownership tree lets Solid automatically clean up a disposed computation by traversing its subtree and calling all `onCleanup` callbacks.\nFor example, when a createEffect's dependencies change, the effect calls all descendant `onCleanup` callbacks before running the effect function again.\nCalling `getOwner` returns the current owner node that is responsible for disposal of the current execution block.\n\nComponents are not computations, so do not create an owner node, but they are typically rendered from a `createEffect` which does, so the result is similar: when a component gets unmounted, all descendant `onCleanup` callbacks get called.\nCalling `getOwner` from a component scope returns the owner that is responsible for rendering and unmounting that component.\n\nNote that the owning tracking scope isn't necessarily tracking.\nFor example, untrack turns off tracking for the duration of a function (without creating a new tracking scope), as do components created via JSX (`\u003cComponent ...\u003e`).",
  "url": "https://github.com/solidjs/solid-docs/blob/HEAD/src/routes/reference/reactive-utilities/get-owner.mdx",
  "metadata": {
    "path": "src/routes/reference/reactive-utilities/get-owner.mdx",
    "repo": "solidjs/solid-docs",
    "repo_url": "https://github.com/solidjs/solid-docs.git",
    "size": 1879,
    "source_type": "github"
  },
  "hash": "69c3a1f2d7a68b888bdce18563a292898baa07c3381bf143bd08fa3070b0f635",
  "timestamp": "2026-02-23T11:43:00.189916556+01:00"
}