Skip to content
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(zone.js): in TaskTrackingZoneSpec track a periodic task until it is cancelled #45391

Closed
wants to merge 1 commit into from

Conversation

Platonn
Copy link
Contributor

@Platonn Platonn commented Mar 18, 2022

Before this change, the macrotask for setInterval(callback, ms) was no
longer tracked by TaskTrackingZoneSpec after the callback was
invoked for the first time. Now the periodic macrotask is tracked until
it is cancelled, e.g. clearInterval(id).

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: #45350

Before this change, the macrotask for setInterval(callback, ms) was no
longer tracked by TaskTrackingZoneSpec after the callback was
invoked for the first time.

What is the new behavior?

Now the periodic macrotask is tracked by TaskTrackingZoneSpec until
the task is cancelled, e.g. clearInterval(id).

Does this PR introduce a breaking change?

  • Yes
  • No

The breaking change is scoped only to the plugin zone.js/plugins/task-tracking. If you used TaskTrackingZoneSpec and checked the pending macroTasks e.g. using (this.ngZone as any)._inner._parent._properties.TaskTrackingZone.getTasksFor('macroTask'), then its behavior slightly changed for periodic macrotasks. For example, previously the setInterval macrotask was no longer tracked after its callback was executed for the first time. Now it's tracked until the task is explicitly cancelled, e.g with clearInterval(id).

@Platonn
Copy link
Contributor Author

Platonn commented Mar 21, 2022

Hi @JiaLiPassion. Thanks for reviewing the PR. Can you help me confirm this PR is a "breaking change" for zone.js and/or even Angular packages?

This PR changes a behavior of TaskTrackingZoneSpec.

…is cancelled

Before this change, the macrotask for `setInterval(callback, ms)` was no
longer tracked by `TaskTrackingZoneSpec` after the `callback` was
invoked for the first time. Now the periodic macrotask is tracked until
it is cancelled, e.g. `clearInterval(id)`.

BREAKING CHANGE: in TaskTrackingZoneSpec track a periodic task until it is cancelled

The breaking change is scoped only to the plugin
`zone.js/plugins/task-tracking`. If you used `TaskTrackingZoneSpec` and
checked the pending macroTasks e.g. using `(this.ngZone as any)._inner
._parent._properties.TaskTrackingZone.getTasksFor('macroTask')`, then
its behavior slightly changed for periodic macrotasks. For example,
previously the `setInterval` macrotask was no longer tracked after its
callback was executed for the first time. Now it's tracked until
the task is explicitly cancelled, e.g  with `clearInterval(id)`.

fixes 45350
@JiaLiPassion JiaLiPassion added area: zones target: minor This PR is targeted for the next minor release labels Mar 22, 2022
@ngbot ngbot bot modified the milestone: Backlog Mar 22, 2022
Copy link
Contributor

@JiaLiPassion JiaLiPassion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
@AndrewKushnir , could you help me to run a global presubmit to check whether this PR impact the g3? Thank you.

@AndrewKushnir AndrewKushnir added the action: presubmit The PR is in need of a google3 presubmit label Mar 23, 2022
@AndrewKushnir
Copy link
Contributor

AndrewKushnir commented Mar 23, 2022

Global Presubmit.

@AndrewKushnir
Copy link
Contributor

@JiaLiPassion FYI the global presubmit went well, no broken/failing targets. Please add the "merge" label is there are no additional changes expected in this PR.

@AndrewKushnir AndrewKushnir removed the action: presubmit The PR is in need of a google3 presubmit label Mar 23, 2022
@JiaLiPassion
Copy link
Contributor

@AndrewKushnir , got it, thank you.

@JiaLiPassion JiaLiPassion added the action: merge The PR is ready for merge by the caretaker label Mar 23, 2022
@dylhunn dylhunn added target: major This PR is targeted for the next major release and removed target: minor This PR is targeted for the next minor release labels Mar 24, 2022
@dylhunn
Copy link
Contributor

dylhunn commented Mar 24, 2022

This PR was merged into the repository by commit f19b36f.

@dylhunn dylhunn closed this in f19b36f Mar 24, 2022
PiyushAgrawal1243 pushed a commit to PiyushAgrawal1243/angular that referenced this pull request Mar 30, 2022
…is cancelled (angular#45391)

Before this change, the macrotask for `setInterval(callback, ms)` was no
longer tracked by `TaskTrackingZoneSpec` after the `callback` was
invoked for the first time. Now the periodic macrotask is tracked until
it is cancelled, e.g. `clearInterval(id)`.

BREAKING CHANGE: in TaskTrackingZoneSpec track a periodic task until it is cancelled

The breaking change is scoped only to the plugin
`zone.js/plugins/task-tracking`. If you used `TaskTrackingZoneSpec` and
checked the pending macroTasks e.g. using `(this.ngZone as any)._inner
._parent._properties.TaskTrackingZone.getTasksFor('macroTask')`, then
its behavior slightly changed for periodic macrotasks. For example,
previously the `setInterval` macrotask was no longer tracked after its
callback was executed for the first time. Now it's tracked until
the task is explicitly cancelled, e.g  with `clearInterval(id)`.

fixes 45350

PR Close angular#45391
josmar-crwdstffng pushed a commit to josmar-crwdstffng/angular that referenced this pull request Apr 8, 2022
…is cancelled (angular#45391)

Before this change, the macrotask for `setInterval(callback, ms)` was no
longer tracked by `TaskTrackingZoneSpec` after the `callback` was
invoked for the first time. Now the periodic macrotask is tracked until
it is cancelled, e.g. `clearInterval(id)`.

BREAKING CHANGE: in TaskTrackingZoneSpec track a periodic task until it is cancelled

The breaking change is scoped only to the plugin
`zone.js/plugins/task-tracking`. If you used `TaskTrackingZoneSpec` and
checked the pending macroTasks e.g. using `(this.ngZone as any)._inner
._parent._properties.TaskTrackingZone.getTasksFor('macroTask')`, then
its behavior slightly changed for periodic macrotasks. For example,
previously the `setInterval` macrotask was no longer tracked after its
callback was executed for the first time. Now it's tracked until
the task is explicitly cancelled, e.g  with `clearInterval(id)`.

fixes 45350

PR Close angular#45391
@angular-automatic-lock-bot
Copy link

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 Apr 24, 2022
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 area: zones target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants