angular/packages/core/src/application
Andrew Scott 06be8034bb fix(core): Microtask scheduling should be used after any application synchronization
Previously, Angular would switch from the macrotask to a microtask
scheduler _only_ when the scheduler was the trigger for the
synchronization. This microtask scheduling is to ensure patterns such as
`Promise.resolve().then(() => updateAppStateAgain())` _during_
synchronization are caught and synchronized again within the same event
loop (guaranteeing that they aren't split across multiple browser paints).

The microtask scheduler should be used after any tick, not just from
those than run within the scheduler to always account for the promises
within synchronization. This is encountered most frequently during
bootstrap, which triggers the tick directly.

In this change we exempt `TestBed.tick` and
`ComponentFixture.detectChanges` from this behavior. Doing so would affect
the timing of stability and tests are quite sensitive to this (e.g.
`fixture.whenStable`). It is somewhat unfortunate that we have "special" test-only
behavior. However, it is important to acknowledge that this only affects
the test-only APIs as well. Any code in the application under test that
triggers `ApplicationRef.tick` directly would still use the microtask
scheduling behavior.

fixes #65444
2025-12-16 13:34:48 -08:00
..
application_config.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
application_init.ts docs: set syntax highlighting of code examples MD code blocks (#59026) 2024-12-04 17:30:28 +01:00
application_module.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
application_ngmodule_factory_compiler.ts refactor: update license text to point to angular.dev (#57901) 2024-09-24 15:33:00 +02:00
application_ref.ts fix(core): Microtask scheduling should be used after any application synchronization 2025-12-16 13:34:48 -08:00
application_tokens.ts refactor(core): correct all typeof ngDevMode comparison patterns introduced by #63875 2025-12-08 10:30:01 -08:00
create_application.ts refactor(core): export profile event as enum and move profile_types.ts and framework to shared devtools folder 2025-11-19 15:22:49 -08:00
platform_tokens.ts docs: Adds links to relevant guides for APIs in core package 2025-11-17 08:47:35 -08:00
tracing.ts refactor(core): correct all typeof ngDevMode comparison patterns introduced by #63875 2025-12-08 10:30:01 -08:00