From 6ed1c1bb8120b489b5f24c782c8b6ce1bc3e3839 Mon Sep 17 00:00:00 2001 From: Alexey Zakhlestin Date: Thu, 22 Feb 2024 12:53:49 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Make=20sure,=20that=20singleton?= =?UTF-8?q?=20is=20attached?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `removeChild` fails loudly if it tries to detach something, which does not have parent, so we always need to check this beforehand. All of the other calls to removeChild() have similar checks already Close #38 --- src/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.tsx b/src/index.tsx index d23cdd2..225f757 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -124,7 +124,7 @@ function initClientProvider() { if (element.parentNode != document.head) { document.head.appendChild(element); } - if (lastVisited && lastVisited.ref) { + if (lastVisited && lastVisited.ref && lastVisited.ref.parentNode) { document.head!.removeChild(lastVisited.ref); }