From 0eaf6ac9730584f831716d1d5759fb9a3f11af3e Mon Sep 17 00:00:00 2001 From: Harrison Noble Date: Tue, 17 Aug 2021 14:52:27 -0500 Subject: [PATCH] #187 small changes --- src/components/Dropdown/Dropdown.tsx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/components/Dropdown/Dropdown.tsx b/src/components/Dropdown/Dropdown.tsx index 07f594a15..e9dd48f76 100644 --- a/src/components/Dropdown/Dropdown.tsx +++ b/src/components/Dropdown/Dropdown.tsx @@ -450,6 +450,7 @@ const Dropdown = ({ useEffect(() => { if (isOpen) { + // setTimeout ensures this code renders after the initial render const timer = window.setTimeout(() => { const optionsContainer = optionsContainerInternalRef.current; const hiddenContainer = hiddenOptionsContainerInternalRef.current; @@ -474,12 +475,8 @@ const Dropdown = ({ // height is returned in pixels hiddenContainer.style.height = `${optionsContainerHeight}px`; } - } - if (optionsContainer) { intersectObserver.observe(optionsContainer); - } - if (hiddenContainer) { intersectObserver.observe(hiddenContainer); } }, 0);