diff --git a/components/markdown/ReleaseMdx.tsx b/components/markdown/ReleaseMdx.tsx index be68292..fe4acb1 100644 --- a/components/markdown/ReleaseMdx.tsx +++ b/components/markdown/ReleaseMdx.tsx @@ -101,7 +101,9 @@ function Changes({ type, children }: ChangesProps) { export { Release, Changes }; -export default { +const ReleaseMdx = { Release, Changes }; + +export default ReleaseMdx; diff --git a/components/mob-toc.tsx b/components/mob-toc.tsx index 5334b54..6a23a0a 100644 --- a/components/mob-toc.tsx +++ b/components/mob-toc.tsx @@ -15,18 +15,18 @@ interface MobTocProps { } const useClickOutside = (ref: React.RefObject, callback: () => void) => { - const handleClick = (e: MouseEvent) => { - if (ref.current && !ref.current.contains(e.target as Node)) { + const handleClick = React.useCallback((event: MouseEvent) => { + if (ref.current && !ref.current.contains(event.target as Node)) { callback(); } - }; + }, [ref, callback]); React.useEffect(() => { document.addEventListener('mousedown', handleClick); return () => { document.removeEventListener('mousedown', handleClick); }; - }, [ref, callback]); + }, [handleClick]); }; export default function MobToc({ tocs }: MobTocProps) { diff --git a/components/toc-observer.tsx b/components/toc-observer.tsx index 2c274d0..03ce16a 100644 --- a/components/toc-observer.tsx +++ b/components/toc-observer.tsx @@ -85,7 +85,7 @@ export default function TocObserver({ }); } }; - }, [data, clickedId]); + }, [data, clickedId, activeId, setActiveId]); const handleLinkClick = useCallback((id: string) => { setClickedId(id);