forked from angular/angular
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(core): newly created and any dirty views should get refreshe…
…d during CD When a view has the `Dirty` flag and is reattached, we should ensure that it is reached and refreshed during the next change detection run from above. In addition, when a view is created and attached, we should ensure that it is reached and refreshed during change detection. This can happen if the view is created and attached outside a change run or when it is created and attached after its insertion view was already checked. In both cases, we should ensure that the view is reached and refreshed during either the current change detection or the next one (if change detection is not already running). We can achieve this by creating all views with the `Dirty` flag set. However, this does happen to be a breaking change in some scenarios. The one identified internally was actually depending on change detection _not_ running immediately because it relied on an input value that was set using `ngModel`. Because `ngModel` sets its value in a `Promise`, it is not available until the _next_ change detection cycle. Ensuring created views run in the current change change detection will result in different behavior in this case. Making option the default is the solution to angular#52928. That will have to wait for a major version.
- Loading branch information
Showing
7 changed files
with
69 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
* @license | ||
* Copyright Google LLC All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
// TODO(atscott): flip default internally ASAP and externally for v18 (#52928) | ||
let _ensureDirtyViewsAreAlwaysReachable = false; | ||
|
||
export function getEnsureDirtyViewsAreAlwaysReachable() { | ||
return _ensureDirtyViewsAreAlwaysReachable; | ||
} | ||
export function setEnsureDirtyViewsAreAlwaysReachable(v: boolean) { | ||
_ensureDirtyViewsAreAlwaysReachable = v; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters