mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
fix(core): Ensure _tick is always run within the TracingSnapshot. (#58881)
Fix a bug where calls to _tick are called without running through the snapshot. This helps ensure that all snapshots that are requested are resumed. PR Close #58881
This commit is contained in:
parent
bae473d718
commit
118803035f
1 changed files with 11 additions and 4 deletions
|
|
@ -591,14 +591,21 @@ export class ApplicationRef {
|
|||
if (!this.zonelessEnabled) {
|
||||
this.dirtyFlags |= ApplicationRefDirtyFlags.ViewTreeGlobal;
|
||||
}
|
||||
|
||||
// Run `_tick()` in the context of the most recent snapshot, if one exists.
|
||||
this.tracingSnapshot?.run(TracingAction.CHANGE_DETECTION, this._tick) ?? this._tick();
|
||||
this._tick();
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
_tick = (): void => {
|
||||
this.tracingSnapshot = null;
|
||||
if (this.tracingSnapshot !== null) {
|
||||
const snapshot = this.tracingSnapshot;
|
||||
this.tracingSnapshot = null;
|
||||
|
||||
// Ensure we always run `_tick()` in the context of the most recent snapshot,
|
||||
// if one exists. Snapshots may be reference counted by the implementation so
|
||||
// we want to ensure that if we request a snapshot that we use it.
|
||||
snapshot.run(TracingAction.CHANGE_DETECTION, this._tick);
|
||||
return;
|
||||
}
|
||||
|
||||
(typeof ngDevMode === 'undefined' || ngDevMode) && this.warnIfDestroyed();
|
||||
if (this._runningTick) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue