From 74a5c896d4cf8c7b111526e68500f66b0a9de5f7 Mon Sep 17 00:00:00 2001 From: Jostein Kringlen Date: Tue, 28 Feb 2023 11:59:20 +0100 Subject: [PATCH] fix(modal): cleanup scroll-doctor lock on unmount --- packages/modal/src/component.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/modal/src/component.tsx b/packages/modal/src/component.tsx index 18fc46ea..3209fbb5 100644 --- a/packages/modal/src/component.tsx +++ b/packages/modal/src/component.tsx @@ -21,6 +21,10 @@ export const Modal = ({ teardown(); if (!contentRef.current) return; props.open && setup(contentRef.current); + + return () => { + teardown(); + }; }, [props.open, contentRef]); useEffect(() => {