Skip to content

fix(zone.js): Closes #31641, hook should set correct current zone#31642

Closed
JiaLiPassion wants to merge 1 commit intoangular:masterfrom
JiaLiPassion:nest-zone
Closed

fix(zone.js): Closes #31641, hook should set correct current zone#31642
JiaLiPassion wants to merge 1 commit intoangular:masterfrom
JiaLiPassion:nest-zone

Conversation

@JiaLiPassion
Copy link
Copy Markdown
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Issue Number: #31641
The case like this will print wrong current zone.

const zone = Zone.current;
const zoneA = zone.fork({
  name: 'A',
  onInvoke: function(
    parentDelegate, currentZone, targetZone, callback, applyThis, applyArgs, source) {
    expect(currentZone.name).toEqual('A');
    return parentDelegate.invoke(targetZone, callback, applyThis, applyArgs, source);
  }
});
const zoneB = zoneA.fork({
  name: 'B'
});
const zoneC = zoneB.fork({name: 'C'});
zoneC.run(function() {});

expect current zone to be A, but the result is B.

What is the new behavior?

the current zone will be A.

Does this PR introduce a breaking change?

  • Yes
  • No

@JiaLiPassion JiaLiPassion requested a review from a team July 19, 2019 03:21
@JiaLiPassion JiaLiPassion requested a review from mhevery July 19, 2019 03:21
@mhevery mhevery added action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release labels Jul 22, 2019
mhevery pushed a commit that referenced this pull request Jul 24, 2019
@mhevery mhevery closed this in 17b32b5 Jul 24, 2019
sabeersulaiman pushed a commit to sabeersulaiman/angular that referenced this pull request Sep 6, 2019
@angular-automatic-lock-bot
Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Sep 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker cla: yes target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants