Skip to content

🚛 Backport createScope(parent) to v3#996

Merged
taras merged 1 commit intov3from
v3-create-scope-with-parent
Apr 15, 2025
Merged

🚛 Backport createScope(parent) to v3#996
taras merged 1 commit intov3from
v3-create-scope-with-parent

Conversation

@cowboyd
Copy link
Copy Markdown
Member

@cowboyd cowboyd commented Apr 15, 2025

Motivation

In order to manually curate trees of effection scopes, you need to be able to specify a parent scope that delimits the lifetime of a scope when you are creating it. V4 has this capability out of the box.

Approach

This backports the functionality from v4. Internally, a refrenence to the Frame object that the scope wraps is maintained. Then, when a scope is passed in, we unwrap the frame and link it up with the parent.

As a nice bonus, because it is there on the object (but not the TypeScript interface) you can now inspect context values from the debugger when you have a reference to the scope.

In order to manually curate trees of effection scopes, you need to be
able to specify a parent scope that delimits the lifetime of a scope
when you are creating it. V4 has this capability out of the box.

This backports the functionality from v4. Internally, a refrenence to
the `Frame` object that the scope wraps is maintained. Then, when a
scope is passed in, we unwrap the frame and link it up with the
parent.

As a nice bonus, you can now inspect context values from the debugger
when you have a reference to the scope.
@cowboyd cowboyd requested a review from taras April 15, 2025 19:58
@taras taras merged commit 2f14b27 into v3 Apr 15, 2025
3 checks passed
@taras taras deleted the v3-create-scope-with-parent branch April 15, 2025 20:01
taras added a commit that referenced this pull request Nov 12, 2025
🚛 Backport `createScope(parent)` to v3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants