angular/packages/core/src
Alex Rickabaugh fc59e2a7b7 feat(core): change effect() execution timing & no-op allowSignalWrites (#57874)
This commit flips the flag that was added in 4e890cc, putting the new effect
timing into... effect :)

BREAKING CHANGE:

Generally this PR has two implications:

* effects which are triggered outside of change detection run as part of
  the change detection process instead of as a microtask. Depending on the
  specifics of application/test setup, this can result in them executing
  earlier or later (or requiring additional test steps to trigger; see below
  examples).

* effects which are triggered during change detection (e.g. by input
  signals) run _earlier_, before the component's template.

We've seen a few common failure cases:

* Tests which used to rely on the `Promise` timing of effects now need to
  `await whenStable()` or call `.detectChanges()` in order for effects to
  run.

* Tests which use faked clocks may need to fast-forward/flush the clock to
  cause effects to run.

* `effect()`s triggered during CD could rely on the application being fully
  rendered (for example, they could easily read computed styles, etc). With
  the change, they run before the component's updates and can get incorrect
  answers. The recent `afterRenderEffect()` API is a natural replacement for
  this style of effect.

* `effect()`s which synchronize with the forms system are particularly
  timing-sensitive and might need to adjust their initialization timing.

Fixes #55311
Fixes #55808
Fixes #55644
Fixes #56863

PR Close #57874
2024-09-19 14:17:56 -07:00
..
application refactor(core): add support for new effect scheduling. (#56501) 2024-09-18 14:52:25 -07:00
authoring feat(core): mark input, output and model APIs as stable (#57804) 2024-09-16 12:13:47 +02:00
change_detection refactor(core): add support for new effect scheduling. (#56501) 2024-09-18 14:52:25 -07:00
compiler refactor: migrate core to prettier formatting (#55488) 2024-04-29 09:49:19 -07:00
debug refactor: migrate core to prettier formatting (#55488) 2024-04-29 09:49:19 -07:00
defer refactor(compiler): finalize hydrate syntax (#57831) 2024-09-17 11:05:17 +02:00
di refactor(core): extract assertNotDestroyed as function. (#57692) 2024-09-11 14:27:35 +00:00
event_dispatch refactor(core): Add experimental support to have one event contract when there are multiple apps on the page. (#57355) 2024-08-13 12:10:34 -07:00
hydration fix(core): Handle @let declaration with array when preparingForHydration (#57816) 2024-09-17 16:29:39 +02:00
i18n refactor: migrate core to prettier formatting (#55488) 2024-04-29 09:49:19 -07:00
interface refactor: migrate core to prettier formatting (#55488) 2024-04-29 09:49:19 -07:00
linker refactor(core): add support for new effect scheduling. (#56501) 2024-09-18 14:52:25 -07:00
metadata refactor(core): deprecate @Component.interpolation (#55778) 2024-05-14 11:48:12 -07:00
platform fix(core): Allow zoneless scheduler to run inside fakeAsync (#56932) 2024-08-15 12:32:24 -04:00
reflection refactor: migrate core to prettier formatting (#55488) 2024-04-29 09:49:19 -07:00
render refactor: migrate core to prettier formatting (#55488) 2024-04-29 09:49:19 -07:00
render3 feat(core): change effect() execution timing & no-op allowSignalWrites (#57874) 2024-09-19 14:17:56 -07:00
sanitization refactor(core): replace usages of removeChild (#57203) 2024-08-07 16:46:09 +00:00
testability refactor: migrate core to prettier formatting (#55488) 2024-04-29 09:49:19 -07:00
util refactor(core): Update callback schedulers to cancel pending timers (#57186) 2024-07-30 18:05:09 +00:00
view refactor: remove unnecessary file (#49042) 2023-02-17 11:08:33 -08:00
zone fix(core): Allow zoneless scheduler to run inside fakeAsync (#56932) 2024-08-15 12:32:24 -04:00
authoring.ts refactor: migrate core to prettier formatting (#55488) 2024-04-29 09:49:19 -07:00
cached_injector_service.ts refactor: migrate core to prettier formatting (#55488) 2024-04-29 09:49:19 -07:00
change_detection.ts refactor: migrate core to prettier formatting (#55488) 2024-04-29 09:49:19 -07:00
console.ts refactor(core): make platform core providers tree-shakable (#45506) 2022-04-12 22:28:23 +00:00
core.externs.js build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
core.ts refactor(core): restructure AfterRenderManager to connect related phases (#57453) 2024-08-23 10:15:19 -07:00
core_private_export.ts refactor(core): restructure AfterRenderManager to connect related phases (#57453) 2024-08-23 10:15:19 -07:00
core_reactivity_export.ts feat(core): add Angular Signals to the public API (#49150) 2023-02-22 11:27:21 -08:00
core_reactivity_export_internal.ts refactor(core): add support for new effect scheduling. (#56501) 2024-09-18 14:52:25 -07:00
core_render3_private_export.ts refactor(compiler): finalize hydrate syntax (#57831) 2024-09-17 11:05:17 +02:00
di.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00
error_details_base_url.ts fix(core): link errors to ADEV (#55554) (#56038) 2024-05-28 12:50:53 +02:00
error_handler.ts fix(core): errors during ApplicationRef.tick should be rethrown for zoneless tests (#56993) 2024-07-29 13:49:00 -07:00
errors.ts refactor(core): integrate let instructions into the runtime (#56527) 2024-06-26 08:48:31 -07:00
event_delegation_utils.ts fix(core): Account for addEventListener to be passed a Window or Document. (#57282) 2024-08-08 08:32:11 -07:00
event_emitter.ts refactor(core): inject PendingTasks as optional in EventEmitter class (#56411) 2024-06-12 13:10:40 -07:00
image_performance_warning.ts fix(core): Do not run image performance warning checks on server (#57234) 2024-08-02 15:53:29 +00:00
linker.ts refactor: migrate core to prettier formatting (#55488) 2024-04-29 09:49:19 -07:00
metadata.ts refactor: migrate core to prettier formatting (#55488) 2024-04-29 09:49:19 -07:00
pending_tasks.ts feat(core): Add async run method on ExperimentalPendingTasks (#56546) 2024-09-13 11:10:08 +02:00
r3_symbols.ts refactor: migrate core to prettier formatting (#55488) 2024-04-29 09:49:19 -07:00
render.ts refactor(core): clean up circular dependencies (#39722) 2020-11-18 09:15:29 -08:00
transfer_state.ts refactor: migrate core to prettier formatting (#55488) 2024-04-29 09:49:19 -07:00
version.ts fix(core): avoid repeated work when parsing version (#53598) 2023-12-18 16:26:36 +00:00
zone.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00