[]previous and next page

getOwner and runWithOwner

The current owner exists only while code runs synchronously inside a root, effect, memo or component.

For agentsUpdated

The current owner exists only while code runs synchronously inside a root, effect, memo or component. After an await, a timer or an event callback it is gone. Capture it with getOwner() and restore it with runWithOwner(owner, fn) so that effects and cleanups created later still belong to the right owner.