From 805d5e2c96301c3a7a8fa03b1d4ff77168133a7e Mon Sep 17 00:00:00 2001
From: Andrey Osiyuk <osiyuk@proton.me>
Date: Sun, 23 Jun 2024 01:20:02 +0200
Subject: [PATCH] Check for existing customElements

---
 packages/ui/src/app/utils/web-api.ts | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/packages/ui/src/app/utils/web-api.ts b/packages/ui/src/app/utils/web-api.ts
index 2d620a352..ec4a8927c 100644
--- a/packages/ui/src/app/utils/web-api.ts
+++ b/packages/ui/src/app/utils/web-api.ts
@@ -84,7 +84,9 @@ export function fixMobileSafariActiveTransition(): void {
 }
 
 export function defineStylesRoot(): void {
-    customElements.define(globalStylesTag, class TcRootElement extends HTMLElement {});
+    if (!customElements.get(globalStylesTag)) {
+        customElements.define(globalStylesTag, class TcRootElement extends HTMLElement {});
+    }
 }
 
 /**