Skip to content

Commit

Permalink
fixup! perf(core): Update LView consumer to only mark component for c…
Browse files Browse the repository at this point in the history
…heck
  • Loading branch information
atscott committed Oct 23, 2023
1 parent 18e3cc8 commit 538caae
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions packages/core/src/render3/instructions/change_detection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,20 +314,26 @@ function detectChangesInViewIfAttached(lView: LView, mode: ChangeDetectionMode)
* view HasChildViewsToRefresh flag is set.
*/
function detectChangesInView(lView: LView, mode: ChangeDetectionMode) {
const isInCheckNoChangesPass = ngDevMode && isInCheckNoChangesMode();
const tView = lView[TVIEW];
const flags = lView[FLAGS];

// Flag cleared before change detection runs so that the view can be re-marked for traversal if
// necessary.
lView[FLAGS] &= ~LViewFlags.HasChildViewsToRefresh;

if ((flags & (LViewFlags.CheckAlways | LViewFlags.Dirty) &&
mode === ChangeDetectionMode.Global) ||
if ((flags & LViewFlags.CheckAlways && mode === ChangeDetectionMode.Global) ||
(flags & LViewFlags.Dirty && mode === ChangeDetectionMode.Global &&
// CheckNoChanges never worked with `OnPush` components because the `Dirty` flag was cleared
// before checkNoChanges ran. Because there is now a loop for to check for backwards views,
// it gives an opportunity for `OnPush` components to be marked `Dirty` before the
// CheckNoChanges pass. We don't want existing errors that are hidden by the current
// CheckNoChanges bug to surface when making unrelated changes.
!isInCheckNoChangesPass) ||
flags & LViewFlags.RefreshView) {
refreshView(tView, lView, tView.template, lView[CONTEXT]);
// If we're running in targeted mode, that means the host view must not have been refreshed
// because when that happens, it descends into children in `Global` mode.
const isInCheckNoChangesPass = ngDevMode && isInCheckNoChangesMode();
if (!isInCheckNoChangesPass && mode === ChangeDetectionMode.Targeted &&
tView.type === TViewType.Component) {
// TODO: Is the component itself always the first item in the registry?
Expand Down

0 comments on commit 538caae

Please sign in to comment.