Skip to content

Commit

Permalink
Fix broken main post fix
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesBochet committed Dec 17, 2024
1 parent edff53f commit bb8c763
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -54,6 +55,12 @@ export const RichTextEditor = ({
}),
);

const [activityBody, setActivityBody] = useRecoilState(
activityBodyFamilyState({
activityId: activityId,
}),
);

const { objectMetadataItem: objectMetadataItemActivity } =
useObjectMetadataItem({
objectNameSingular: activityObjectNameSingular,
Expand Down Expand Up @@ -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) ?? '';

Expand Down

0 comments on commit bb8c763

Please sign in to comment.