From c5c0c3ecb449533c64411793d96f9d054f6de4da Mon Sep 17 00:00:00 2001 From: Maksym Tsymbarov Date: Fri, 20 Feb 2026 14:55:29 +0200 Subject: [PATCH 1/2] Synced destroying of toast and resetting data --- ui-ngx/src/app/shared/components/toast.directive.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ui-ngx/src/app/shared/components/toast.directive.ts b/ui-ngx/src/app/shared/components/toast.directive.ts index ac3d284474..3f38401ac4 100644 --- a/ui-ngx/src/app/shared/components/toast.directive.ts +++ b/ui-ngx/src/app/shared/components/toast.directive.ts @@ -135,8 +135,11 @@ export class ToastDirective implements AfterViewInit, OnDestroy { notification: notificationMessage, panelClass, destroyToastComponent: () => { - this.viewContainerRef.detach(0); - this.toastComponentRef.destroy(); + if (this.toastComponentRef) { + this.viewContainerRef.detach(0); + this.toastComponentRef.destroy(); + this.toastComponentRef = null; + } } }; const providers: StaticProvider[] = [ @@ -163,7 +166,6 @@ export class ToastDirective implements AfterViewInit, OnDestroy { clearTimeout(this.dismissTimeout); this.dismissTimeout = null; } - this.toastComponentRef = null; this.currentMessage = null; }); }); From bf712e2f80dcb8fd600b1590ffeab87864e7c463 Mon Sep 17 00:00:00 2001 From: Maksym Tsymbarov Date: Tue, 24 Feb 2026 11:09:10 +0100 Subject: [PATCH 2/2] Additional Fixes --- ui-ngx/src/app/shared/components/toast.directive.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-ngx/src/app/shared/components/toast.directive.ts b/ui-ngx/src/app/shared/components/toast.directive.ts index 3f38401ac4..773a6d298e 100644 --- a/ui-ngx/src/app/shared/components/toast.directive.ts +++ b/ui-ngx/src/app/shared/components/toast.directive.ts @@ -138,7 +138,6 @@ export class ToastDirective implements AfterViewInit, OnDestroy { if (this.toastComponentRef) { this.viewContainerRef.detach(0); this.toastComponentRef.destroy(); - this.toastComponentRef = null; } } }; @@ -166,6 +165,7 @@ export class ToastDirective implements AfterViewInit, OnDestroy { clearTimeout(this.dismissTimeout); this.dismissTimeout = null; } + this.toastComponentRef = null; this.currentMessage = null; }); });