Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions lib/diagnostics_channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ class RunStoresScope {
#stack;

constructor(activeChannel, data) {
using stack = new DisposableStack();
if (activeChannel._stores?.size) {
using stack = new DisposableStack();

// Enter stores using withScope
if (activeChannel._stores) {
// Enter stores using withScope
for (const entry of activeChannel._stores.entries()) {
const store = entry[0];
const transform = entry[1];
Expand All @@ -122,17 +122,19 @@ class RunStoresScope {

DisposableStackPrototypeUse(stack, store.withScope(newContext));
}
}

// Publish data
activeChannel.publish(data);
// Publish data
activeChannel.publish(data);

// Transfer ownership of the stack
this.#stack = DisposableStackPrototypeMove(stack);
// Transfer ownership of the stack
this.#stack = DisposableStackPrototypeMove(stack);
} else {
activeChannel.publish(data);
}
}

[SymbolDispose]() {
this.#stack[SymbolDispose]();
this.#stack?.[SymbolDispose]();
}
}

Expand Down
Loading