-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: parent step for API calls inside waitForEvent callback #33409
base: main
Are you sure you want to change the base?
Conversation
Test results for "tests 1"36791 passed, 630 skipped Merge workflow run. |
@@ -39,6 +39,17 @@ class ZoneManager { | |||
return this._asyncLocalStorage.run(undefined, func); | |||
} | |||
|
|||
currentZoneBefore(type: ZoneType): ZoneReference { | |||
let zone = this._asyncLocalStorage.getStore(); | |||
while (zone && zone.type === type) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand the logic here.
|
||
constructor(channelOwner: ChannelOwner<channels.EventTargetChannel>, event: string) { | ||
this._waitId = createGuid(); | ||
this._channelOwner = channelOwner; | ||
// Save current chain before the wait for event API call (we don't nest API calls) | ||
// and restore it later to find proper parent for the event listener. | ||
this._savedZone = zones.currentZoneBefore('apiZone'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does it mean zone before zone? Do you mean simply current zone?
@@ -53,6 +64,20 @@ class ZoneManager { | |||
} | |||
} | |||
|
|||
export class ZoneReference { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's is zone reference? I thought zone was a zone reference already. Real zone is the async context. I don't think we need 3 types, should be just async context and a logical apiCall zone with a parent.
Fixes #33186