Fix broken main post fix

This commit is contained in:
Charles Bochet 2024-12-17 17:10:51 +01:00
parent edff53f5b8
commit bb8c763f9c

View File

@ -8,6 +8,7 @@ import { useDebouncedCallback } from 'use-debounce';
import { v4 } from 'uuid';
import { useUpsertActivity } from '@/activities/hooks/useUpsertActivity';
import { activityBodyFamilyState } from '@/activities/states/activityBodyFamilyState';
import { activityTitleHasBeenSetFamilyState } from '@/activities/states/activityTitleHasBeenSetFamilyState';
import { canCreateActivityState } from '@/activities/states/canCreateActivityState';
import { ActivityEditorHotkeyScope } from '@/activities/types/ActivityEditorHotkeyScope';
@ -54,6 +55,12 @@ export const RichTextEditor = ({
}),
);
const [activityBody, setActivityBody] = useRecoilState(
activityBodyFamilyState({
activityId: activityId,
}),
);
const { objectMetadataItem: objectMetadataItemActivity } =
useObjectMetadataItem({
objectNameSingular: activityObjectNameSingular,
@ -234,6 +241,12 @@ 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) ?? '';