From 68441b90e5748f53280bc59d06c5c3159a97cd9f Mon Sep 17 00:00:00 2001 From: mrjvs Date: Mon, 9 Oct 2023 21:02:18 +0200 Subject: [PATCH] put cleanup in correct place --- src/components/overlays/OverlayDisplay.tsx | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/components/overlays/OverlayDisplay.tsx b/src/components/overlays/OverlayDisplay.tsx index 99613a82..93054df1 100644 --- a/src/components/overlays/OverlayDisplay.tsx +++ b/src/components/overlays/OverlayDisplay.tsx @@ -12,15 +12,8 @@ export interface OverlayProps { } export function OverlayDisplay(props: { children: ReactNode }) { - return
{props.children}
; -} - -export function Overlay(props: OverlayProps) { - const router = useInternalOverlayRouter(props.id); + const router = useInternalOverlayRouter("hello world :)"); const refRouter = useRef(router); - const [portalElement, setPortalElement] = useState(null); - const ref = useRef(null); - const target = useRef(null); // close router on first mount, we dont want persist routes for overlays useEffect(() => { @@ -30,6 +23,14 @@ export function Overlay(props: OverlayProps) { r.close(); }; }, []); + return
{props.children}
; +} + +export function Overlay(props: OverlayProps) { + const router = useInternalOverlayRouter(props.id); + const [portalElement, setPortalElement] = useState(null); + const ref = useRef(null); + const target = useRef(null); useEffect(() => { function listen(e: MouseEvent) {