File tree Expand file tree Collapse file tree
src/routes/reference/reactive-utilities Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,6 +30,8 @@ type Owner = unknown;
3030function getOwner(): Owner | null ;
3131```
3232
33+ The concrete owner shape is internal and is primarily useful with [ ` runWithOwner ` ] ( /reference/reactive-utilities/run-with-owner ) .
34+
3335## Parameters
3436
3537` getOwner ` does not take any parameters.
@@ -42,6 +44,7 @@ Returns the current owner or `null` when no owner is active.
4244
4345## Behavior
4446
47+ - ` getOwner ` returns the current owner and does not create or modify ownership.
4548- Owners determine cleanup and context lookup for descendant computations.
4649- A computation created inside the current scope becomes part of the current owner tree unless ownership is overridden.
4750- Components are not computations and do not create owner nodes themselves.
@@ -57,11 +60,13 @@ import { getOwner, runWithOwner } from "solid-js";
5760
5861const owner = getOwner ();
5962
60- queueMicrotask (() => {
61- runWithOwner (owner , () => {
62- console .log (" owner restored" );
63+ if (owner ) {
64+ queueMicrotask (() => {
65+ runWithOwner (owner , () => {
66+ console .log (" owner restored" );
67+ });
6368 });
64- });
69+ }
6570```
6671
6772## Related
You can’t perform that action at this time.
0 commit comments