From 8a83e01ce07be9343e410022cd8e42d6b5d592fd Mon Sep 17 00:00:00 2001 From: Mattias Granlund Date: Fri, 15 Mar 2024 21:11:36 +0100 Subject: [PATCH] Fix dev problem when hot reloading - must check if element is still connected before manipulating element --- gitbutler-ui/src/lib/utils/tooltip.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitbutler-ui/src/lib/utils/tooltip.ts b/gitbutler-ui/src/lib/utils/tooltip.ts index 64e23473f..b38a83bd1 100644 --- a/gitbutler-ui/src/lib/utils/tooltip.ts +++ b/gitbutler-ui/src/lib/utils/tooltip.ts @@ -47,7 +47,7 @@ export function tooltip(node: HTMLElement, optsOrString: ToolTipOptions | string } function show() { - if (!text) return; + if (!text || !node.isConnected) return; tooltip = document.createElement('div') as HTMLDivElement; // TODO: Can we co-locate tooltip.js & tooltip.postcss? tooltip.classList.add('tooltip', 'text-base-11'); // see tooltip.postcss