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(core): Prevent markForCheck
during change detection from causin…
#54900
Conversation
004f259
to
de04163
Compare
2 test-only failures. One pre-existing failure (with the fix already submitted). |
…g infinite loops 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 angular#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.
caretaker note: green TGP (other than mentioned failures that have been/are being fixed) |
This PR was merged into the repository by commit 314112d. |
…g infinite loops (angular#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 angular#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 angular#54900
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
…g infinite loops
This change updates the approach to the loop in
ApplicationRef.tick
for allowing state updates inafterRender
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 ofmarkForCheck
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.