From 3e3a95c853c320c0393fbf7c0961c8f1de698cea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oddbj=C3=B8rn=20=C3=98vernes?= Date: Mon, 16 Sep 2024 15:40:02 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20blind=20fix=20for=20"disconnecte?= =?UTF-8?q?d"=20popover=20(#3610)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 🐛 blind fix for "disconnected" popover * try using isConnected * try with timeout * restore version * fix package.json --- .../eds-core-react/src/components/Popover/Popover.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/eds-core-react/src/components/Popover/Popover.tsx b/packages/eds-core-react/src/components/Popover/Popover.tsx index 080dfb7fcd..891fa72635 100644 --- a/packages/eds-core-react/src/components/Popover/Popover.tsx +++ b/packages/eds-core-react/src/components/Popover/Popover.tsx @@ -14,7 +14,6 @@ import { mergeRefs, useToken, outlineTemplate, - useIsomorphicLayoutEffect, } from '@equinor/eds-utils' import { popover as popoverToken } from './Popover.tokens' import { useEds } from '../EdsProvider' @@ -165,9 +164,13 @@ export const Popover = forwardRef( const { getFloatingProps } = useInteractions([useDismiss(context)]) - useIsomorphicLayoutEffect(() => { + useEffect(() => { if (open) { - refs.floating.current?.showPopover() + setTimeout(() => { + if (refs.floating.current?.isConnected) { + refs.floating.current.showPopover() + } + }, 1) } else { refs.floating.current?.hidePopover() }