From a8310fa0ff87f0e63ec995302f1b291561238a6e Mon Sep 17 00:00:00 2001 From: Anthony LC Date: Wed, 11 Dec 2024 11:09:50 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=EF=B8=8F(frontend)=20remove=20debounc?= =?UTF-8?q?e=20on=20useHeadings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We remove the debounce on useHeadings, it decreases the user experience and it's not necessary a big performance improvement. --- .../src/features/docs/doc-editor/hook/useHeadings.tsx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/frontend/apps/impress/src/features/docs/doc-editor/hook/useHeadings.tsx b/src/frontend/apps/impress/src/features/docs/doc-editor/hook/useHeadings.tsx index 9c6084873..9468a7963 100644 --- a/src/frontend/apps/impress/src/features/docs/doc-editor/hook/useHeadings.tsx +++ b/src/frontend/apps/impress/src/features/docs/doc-editor/hook/useHeadings.tsx @@ -9,14 +9,11 @@ export const useHeadings = (editor: BlockNoteEditor) => { useEffect(() => { setHeadings(editor); - let timeout: NodeJS.Timeout; editor?.onEditorContentChange(() => { - clearTimeout(timeout); - timeout = setTimeout(() => setHeadings(editor), 200); + setHeadings(editor); }); return () => { - clearTimeout(timeout); resetHeadings(); }; }, [editor, resetHeadings, setHeadings]);