From 2205c8993fa12129cdbb742159ffa8a6d18bb31a Mon Sep 17 00:00:00 2001 From: arturovt Date: Fri, 3 Nov 2023 21:56:29 +0200 Subject: [PATCH] refactor(common): remove `load` event listener once it is fired (#52512) This commit removes the `load` event listener once it has fired within the `ImagePerformanceWarning`. The `load` event listener prevents the zone stuff from being garbage collected in development mode when debugging microfrontend applications that may be destroyed multiple times. PR Close #52512 --- packages/core/src/image_performance_warning.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/src/image_performance_warning.ts b/packages/core/src/image_performance_warning.ts index b7490789627..7bc0c2194d9 100644 --- a/packages/core/src/image_performance_warning.ts +++ b/packages/core/src/image_performance_warning.ts @@ -49,7 +49,7 @@ export class ImagePerformanceWarning implements OnDestroy { // Angular doesn't have to run change detection whenever any asynchronous tasks are invoked in // the scope of this functionality. this.ngZone.runOutsideAngular(() => { - this.window?.addEventListener('load', waitToScan); + this.window?.addEventListener('load', waitToScan, {once: true}); }); } }