From 7ab039653d5c71b01663e06f707a3e23d7f1d53f Mon Sep 17 00:00:00 2001 From: danloh Date: Wed, 6 Mar 2024 18:31:18 -0800 Subject: [PATCH] fix: build with warning --- src/components/note/NoteNewModal.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/note/NoteNewModal.tsx b/src/components/note/NoteNewModal.tsx index e4d95249..aceb6c97 100644 --- a/src/components/note/NoteNewModal.tsx +++ b/src/components/note/NoteNewModal.tsx @@ -1,4 +1,4 @@ -import { useMemo } from 'react'; +import { useCallback, useMemo } from 'react'; import useHotkeys from 'editor/hooks/useHotkeys'; import { store } from 'lib/store'; import FindOrCreateInput from './NoteNewInput'; @@ -10,10 +10,10 @@ type Props = { export default function FindOrCreateModal(props: Props) { const { setIsOpen } = props; - const handleClose = () => { + const handleClose = useCallback(() => { store.getState().setCurrentCard(undefined); setIsOpen(false) - } + }, [setIsOpen]) const hotkeys = useMemo( () => [ @@ -22,7 +22,7 @@ export default function FindOrCreateModal(props: Props) { callback: () => handleClose(), }, ], - [setIsOpen] + [handleClose] ); useHotkeys(hotkeys);