From ce14a9249dda589f68953498ef9fb1c1b5e02d90 Mon Sep 17 00:00:00 2001 From: SerhiiTsybulskyi Date: Wed, 12 Jun 2024 17:14:18 +0300 Subject: [PATCH] add missing null check --- src/layers/Menu/Menu.story.tsx | 2 +- src/utils/Position/usePosition.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/layers/Menu/Menu.story.tsx b/src/layers/Menu/Menu.story.tsx index 079f46f5..f107b2d1 100644 --- a/src/layers/Menu/Menu.story.tsx +++ b/src/layers/Menu/Menu.story.tsx @@ -35,7 +35,7 @@ export const Unstyled = () => { }; export const Nested = () => { - const { toggleOpen, ref, Menu: MenuComponent } = useMenu({ open: true }); + const { toggleOpen, ref, Menu: MenuComponent } = useMenu({ open: false }); const itemStyle = { padding: 5, borderBottom: 'solid 1px black' }; return ( diff --git a/src/utils/Position/usePosition.tsx b/src/utils/Position/usePosition.tsx index 0995ca4c..1b1bb828 100644 --- a/src/utils/Position/usePosition.tsx +++ b/src/utils/Position/usePosition.tsx @@ -62,7 +62,7 @@ export const usePosition = ({ }); useEffect(() => { - if (isVirtualElement) { + if (isVirtualElement && reference) { const refObject = reference as ReferenceObject; refs.setPositionReference({ getBoundingClientRect() {