Skip to content

Conversation

@atscott
Copy link
Contributor

@atscott atscott commented Jul 10, 2024

The zoneless scheduler callback was executed in the root zone rather than simply in runOutsideAngular to allow us to land the hybrid mode change detection (scheduler always enabled, even for zones) without breaking a ton of existing fakeAsync tests that could/would fail with the "timer(s) still in queue" error. However, this caused another problem: when a test executes inside fakeAsync, it cannot flush the scheduled time. A similar problem exists with event and run coalescing (#56767). This change would allow fakeAsync to flush the zoneless-scheduled change detections without breaking existing fakeAsync tests that end without flushing pending change detections.

@atscott atscott force-pushed the schedulerTimersFakeAsync branch 2 times, most recently from a38c4a3 to 65f39c1 Compare July 10, 2024 18:51
@atscott atscott added the requires: TGP This PR requires a passing TGP before merging is allowed label Jul 10, 2024
@atscott atscott force-pushed the schedulerTimersFakeAsync branch 2 times, most recently from 1285e03 to 573f212 Compare July 11, 2024 21:43
@atscott atscott requested a review from alxhub July 11, 2024 22:28
@atscott atscott force-pushed the schedulerTimersFakeAsync branch 2 times, most recently from f8d7020 to 50b4523 Compare July 11, 2024 23:05
@angular-robot angular-robot bot added the area: core Issues related to the framework runtime label Jul 11, 2024
@ngbot ngbot bot added this to the Backlog milestone Jul 11, 2024
@atscott atscott changed the title experiment: Allow zoneless scheduler to run in fakeAsync zone fix(core): Allow zoneless scheduler to run inside fakeAsync Jul 11, 2024
@atscott atscott marked this pull request as ready for review July 11, 2024 23:06
@pullapprove pullapprove bot requested a review from JiaLiPassion July 11, 2024 23:06
@pullapprove pullapprove bot removed the requires: TGP This PR requires a passing TGP before merging is allowed label Jul 11, 2024
@atscott atscott marked this pull request as draft July 11, 2024 23:48
@atscott atscott force-pushed the schedulerTimersFakeAsync branch 5 times, most recently from 26651bf to 61780c8 Compare July 17, 2024 23:49
@atscott atscott force-pushed the schedulerTimersFakeAsync branch 3 times, most recently from 018cfe5 to 7847076 Compare July 23, 2024 18:47
@atscott atscott marked this pull request as ready for review July 23, 2024 18:48
@atscott atscott force-pushed the schedulerTimersFakeAsync branch from 7847076 to 62c49eb Compare July 23, 2024 19:15
@atscott atscott added the target: patch This PR is targeted for the next patch release label Jul 23, 2024
@atscott atscott force-pushed the schedulerTimersFakeAsync branch from 62c49eb to 701bb4b Compare July 25, 2024 19:33
@atscott atscott force-pushed the schedulerTimersFakeAsync branch 3 times, most recently from 0d1565d to 0e704f8 Compare August 8, 2024 18:43
@dylhunn
Copy link
Contributor

dylhunn commented Aug 15, 2024

This PR was merged into the repository by commit 3b0dca7.

The changes were merged into the following branches: main, 18.2.x

dylhunn pushed a commit that referenced this pull request Aug 15, 2024
The zoneless scheduler callback was executed in the root zone rather
than simply in `runOutsideAngular` to allow us to land the hybrid mode
change detection (scheduler always enabled, even for zones) without
breaking a ton of existing `fakeAsync` tests that could/would fail with
the "timer(s) still in queue" error. However, this caused another
problem: when a test executes inside `fakeAsync`, it cannot flush the
scheduled time. A similar problem exists with event and run coalescing (#56767).
This change would allow `fakeAsync` to flush the zoneless-scheduled
change detections and minimize breaking existing tests
by flushing pending timers at the end of the test, which actually now
matches what's done internally.

PR Close #56932
@dylhunn dylhunn closed this in 3b0dca7 Aug 15, 2024
@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 Sep 15, 2024
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: core Issues related to the framework runtime PullApprove: disable target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants