added timeout to avoid appending of blocks (#6725)

@FelixMalfait
fixes #6724  
Thanks :)

---------

Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
This commit is contained in:
nitin 2024-09-07 03:08:52 +05:30 committed by GitHub
parent e2882056a9
commit 7a8d46a51d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -256,10 +256,16 @@ export const RichTextEditor = ({
const handleBodyChangeDebounced = useDebouncedCallback(handleBodyChange, 500);
// See https://github.com/twentyhq/twenty/issues/6724 for explanation
const setActivityBodyDebouncedToAvoidDragBug = useDebouncedCallback(
setActivityBody,
100,
);
const handleEditorChange = () => {
const newStringifiedBody = JSON.stringify(editor.document) ?? '';
setActivityBody(newStringifiedBody);
setActivityBodyDebouncedToAvoidDragBug(newStringifiedBody);
handleBodyChangeDebounced(newStringifiedBody);
};