From eeb2b46f763d20ba67c68acf7af183341ae3676e Mon Sep 17 00:00:00 2001 From: Xanazf Date: Fri, 18 Oct 2024 00:05:06 +0300 Subject: [PATCH] moved cleanup out of mount --- src/components/navigation/sidebars/nav/index.tsx | 7 +++---- src/components/navigation/sidebars/toc/index.tsx | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/components/navigation/sidebars/nav/index.tsx b/src/components/navigation/sidebars/nav/index.tsx index 8ba78de..ec53192 100644 --- a/src/components/navigation/sidebars/nav/index.tsx +++ b/src/components/navigation/sidebars/nav/index.tsx @@ -47,10 +47,9 @@ const NavComponent: Component = props => { } }; - onMount(() => { - onCleanup(() => { - window.removeEventListener("click", handleClickOutside); - }); + onMount(() => {}); + onCleanup(() => { + window.removeEventListener("click", handleClickOutside); }); createEffect(() => { diff --git a/src/components/navigation/sidebars/toc/index.tsx b/src/components/navigation/sidebars/toc/index.tsx index 64eb910..5b07481 100644 --- a/src/components/navigation/sidebars/toc/index.tsx +++ b/src/components/navigation/sidebars/toc/index.tsx @@ -40,10 +40,9 @@ const TableOfContents: Component = props => { } }; - onMount(() => { - onCleanup(() => { - window.removeEventListener("click", handleClickOutside); - }); + onMount(() => {}); + onCleanup(() => { + window.removeEventListener("click", handleClickOutside); }); createEffect(() => {