angular/packages/core
Andrew Scott 314112de99 fix(core): Prevent markForCheck during change detection from causing infinite loops (#54900)
This change updates the approach to the loop in `ApplicationRef.tick`
for allowing state updates in `afterRender` hooks. It is valid to update
state in render hooks and we need to ensure we refresh views that may be
marked for check in these hooks (this can happen simply as a result of
focusing an element). This change ensures that the behavior of `markForCheck`
with respect to this loop does not change while we are actively running
change detection on a view tree.

This approach also has the benefit of preventing a regression for #18917,
where updating state in animation listeners can cause `ExpressionChanged...Error`
This should be allowed - there is nothing wrong with respect to unidirectional
data flow in this case.

There may be other cases in the future where it is valid to update
state. Rather than wrapping the render hooks and the animation flushing
in something which flips a global state flag, the idea here is that
`markForCheck` is safe and valid in all cases whenever change detection
is not actively running.

PR Close #54900
2024-03-18 16:54:01 -07:00
..
global docs(docs-infra): Add missing API entries to ADEV (#54530) 2024-02-21 16:41:33 +00:00
primitives/signals refactor(core): rework runtime implementation to simplify and fix issues (#54103) 2024-02-06 15:04:36 +00:00
reference-manifests build: add target to generate api manifest (#52472) 2023-11-02 11:00:59 -07:00
rxjs-interop refactor(core): EventEmitter implements OutputRef. (#54650) 2024-03-06 12:34:39 +01:00
schematics feat(core): add migration for invalid two-way bindings (#54630) 2024-02-28 18:06:23 +01:00
src fix(core): Prevent markForCheck during change detection from causing infinite loops (#54900) 2024-03-18 16:54:01 -07:00
test fix(core): Prevent markForCheck during change detection from causing infinite loops (#54900) 2024-03-18 16:54:01 -07:00
testing fix(core): ComponentFixture autoDetect respects OnPush flag of host view (#54824) 2024-03-13 08:32:03 -07:00
BUILD.bazel test: replace fake_core with real @angular/core output (#54650) 2024-03-06 12:34:38 +01:00
index.ts refactor(core): made comment structure consistent in index.ts (#43684) 2021-10-21 18:39:58 +00:00
package.json build: update node.js engines version to be more explicate about v20 support (#52448) 2023-10-31 14:18:36 -07:00
PACKAGE.md docs: add package doc files (#26047) 2018-10-05 15:42:14 -07:00
public_api.ts build: update license headers to reference Google LLC (#37205) 2020-05-26 14:26:58 -04:00