diff --git a/src/renderer/components/modal/modal.tsx b/src/renderer/components/modal/modal.tsx index 288930e3..9b5f8cf5 100644 --- a/src/renderer/components/modal/modal.tsx +++ b/src/renderer/components/modal/modal.tsx @@ -1,4 +1,4 @@ -import { useEffect, useRef, useState } from "react"; +import { useCallback, useEffect, useRef, useState } from "react"; import { createPortal } from "react-dom"; import { XIcon } from "@primer/octicons-react"; @@ -25,7 +25,7 @@ export function Modal({ const dispatch = useAppDispatch(); const modalContentRef = useRef(null); - const handleCloseClick = () => { + const handleCloseClick = useCallback(() => { setIsClosing(true); const zero = performance.now(); @@ -37,7 +37,7 @@ export function Modal({ setIsClosing(false); } }); - }; + }, [onClose]); const isTopMostModal = () => { const openModals = document.querySelectorAll("[role=modal]");