perf(core): Stop marking dirty to the root when a detached view is found #52999
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With this change, detached views no longer cause their parents to be marked dirty and subsequently refreshed.
This is a small optimization to stop marking parent views dirty when a detached view is encountered. When running change detection, we stop traversing to children when the view is detached. This means a detached view isn't even reachable from parents so it's wasteful to mark them dirty.
There is a risk, albeit very small, that this could exacerbate the issue described in #52928 where attaching a dirty view does not mark parents dirty. This would be the case if a detached view is marked dirty and then synchronously attached again. Regardless, it may be prudent to address #52928 first or at the same time.
Green TGP other than one unrelated build failure.