()
| 266 | } |
| 267 | |
| 268 | override ngAfterViewInit(): void { |
| 269 | super.ngAfterViewInit(); |
| 270 | |
| 271 | // Prior to #30314 the stepper had animation `done` events bound to each animated container. |
| 272 | // The animations module was firing them on initialization and for each subsequent animation. |
| 273 | // Since the events were bound in the template, it had the unintended side-effect of triggering |
| 274 | // change detection as well. It appears that this side-effect ended up being load-bearing, |
| 275 | // because it was ensuring that the content elements (e.g. `matStepLabel`) that are defined |
| 276 | // in sub-components actually get picked up in a timely fashion. This subscription simulates |
| 277 | // the same change detection by using `queueMicrotask` similarly to the animations module. |
| 278 | if (typeof queueMicrotask === 'function') { |
| 279 | let hasEmittedInitial = false; |
| 280 | this._animatedContainers.changes |
| 281 | .pipe(startWith(null), takeUntil(this._destroyed)) |
| 282 | .subscribe(() => |
| 283 | queueMicrotask(() => { |
| 284 | // Simulate the initial `animationDone` event |
| 285 | // that gets emitted by the animations module. |
| 286 | if (!hasEmittedInitial) { |
| 287 | hasEmittedInitial = true; |
| 288 | this.animationDone.emit(); |
| 289 | } |
| 290 | |
| 291 | this._stateChanged(); |
| 292 | }), |
| 293 | ); |
| 294 | } |
| 295 | } |
| 296 | |
| 297 | override ngOnDestroy(): void { |
| 298 | super.ngOnDestroy(); |
nothing calls this directly
no test coverage detected