66 * found in the LICENSE file at https://angular.dev/license
77 */
88
9- import { TracingAction , TracingService , TracingSnapshot } from '../../application/tracing' ;
9+ import { AfterRenderPhase , AfterRenderRef } from './api' ;
10+ import { NgZone } from '../../zone' ;
11+ import { inject } from '../../di/injector_compatibility' ;
12+ import { ɵɵdefineInjectable } from '../../di/interface/defs' ;
13+ import { ErrorHandler } from '../../error_handler' ;
1014import {
1115 ChangeDetectionScheduler ,
1216 NotificationSource ,
1317} from '../../change_detection/scheduling/zoneless_scheduling' ;
14- import { inject } from '../../di/injector_compatibility' ;
15- import { ɵɵdefineInjectable } from '../../di/interface/defs' ;
16- import { ErrorHandler } from '../../error_handler' ;
1718import { type DestroyRef } from '../../linker/destroy_ref' ;
18- import { NgZone } from '../../zone' ;
19- import { AFTER_RENDER_SEQUENCES_TO_ADD , FLAGS , LView , LViewFlags } from '../interfaces/view' ;
20- import { markAncestorsForTraversal } from '../util/view_utils' ;
21- import { AfterRenderPhase , AfterRenderRef } from './api' ;
19+ import { TracingAction , TracingService , TracingSnapshot } from '../../application/tracing' ;
2220
2321export class AfterRenderManager {
2422 impl : AfterRenderImpl | null = null ;
@@ -104,34 +102,22 @@ export class AfterRenderImpl {
104102 this . sequences . add ( sequence ) ;
105103 }
106104 if ( this . deferredRegistrations . size > 0 ) {
107- this . scheduler . notify ( NotificationSource . RenderHook ) ;
105+ this . scheduler . notify ( NotificationSource . DeferredRenderHook ) ;
108106 }
109107 this . deferredRegistrations . clear ( ) ;
110108 }
111109
112110 register ( sequence : AfterRenderSequence ) : void {
113- const { view} = sequence ;
114- if ( view !== undefined ) {
115- // Delay adding it to the manager, add it to the view instead.
116- ( view [ AFTER_RENDER_SEQUENCES_TO_ADD ] ??= [ ] ) . push ( sequence ) ;
117-
118- // Mark the view for traversal to ensure we eventually schedule the afterNextRender.
119- markAncestorsForTraversal ( view ) ;
120- view [ FLAGS ] |= LViewFlags . HasChildViewsToRefresh ;
121- } else if ( ! this . executing ) {
122- this . addSequence ( sequence ) ;
111+ if ( ! this . executing ) {
112+ this . sequences . add ( sequence ) ;
113+ // Trigger an `ApplicationRef.tick()` if one is not already pending/running, because we have a
114+ // new render hook that needs to run.
115+ this . scheduler . notify ( NotificationSource . RenderHook ) ;
123116 } else {
124117 this . deferredRegistrations . add ( sequence ) ;
125118 }
126119 }
127120
128- addSequence ( sequence : AfterRenderSequence ) : void {
129- this . sequences . add ( sequence ) ;
130- // Trigger an `ApplicationRef.tick()` if one is not already pending/running, because we have a
131- // new render hook that needs to run.
132- this . scheduler . notify ( NotificationSource . RenderHook ) ;
133- }
134-
135121 unregister ( sequence : AfterRenderSequence ) : void {
136122 if ( this . executing && this . sequences . has ( sequence ) ) {
137123 // We can't remove an `AfterRenderSequence` in the middle of iteration.
@@ -186,7 +172,6 @@ export class AfterRenderSequence implements AfterRenderRef {
186172 constructor (
187173 readonly impl : AfterRenderImpl ,
188174 readonly hooks : AfterRenderHooks ,
189- readonly view : LView | undefined ,
190175 public once : boolean ,
191176 destroyRef : DestroyRef | null ,
192177 public snapshot : TracingSnapshot | null = null ,
@@ -209,9 +194,5 @@ export class AfterRenderSequence implements AfterRenderRef {
209194 destroy ( ) : void {
210195 this . impl . unregister ( this ) ;
211196 this . unregisterOnDestroy ?.( ) ;
212- const scheduled = this . view ?. [ AFTER_RENDER_SEQUENCES_TO_ADD ] ;
213- if ( scheduled ) {
214- this . view [ AFTER_RENDER_SEQUENCES_TO_ADD ] = scheduled . filter ( ( s ) => s !== this ) ;
215- }
216197 }
217198}
0 commit comments