⚡️(frontend) remove debounce on useHeadings
We remove the debounce on useHeadings, it decreases the user experience and it's not necessary a big performance improvement.
This commit is contained in:
@@ -9,14 +9,11 @@ export const useHeadings = (editor: BlockNoteEditor) => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setHeadings(editor);
|
setHeadings(editor);
|
||||||
|
|
||||||
let timeout: NodeJS.Timeout;
|
|
||||||
editor?.onEditorContentChange(() => {
|
editor?.onEditorContentChange(() => {
|
||||||
clearTimeout(timeout);
|
setHeadings(editor);
|
||||||
timeout = setTimeout(() => setHeadings(editor), 200);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
clearTimeout(timeout);
|
|
||||||
resetHeadings();
|
resetHeadings();
|
||||||
};
|
};
|
||||||
}, [editor, resetHeadings, setHeadings]);
|
}, [editor, resetHeadings, setHeadings]);
|
||||||
|
|||||||
Reference in New Issue
Block a user