The block should not clutter the body upon being dragged.
Technical inputs
This issue is caused by setActivityBody(newStringifiedBody) in the handleEditorChange function within the RichTextEditor component, which triggers re-renders causing the issue.
Relevant Code
Proposed Solutions
I have identified two potential solutions which works:
Use useRef instead of useRecoilState for state management: This approach could prevent re-renders but may conflict with existing ESLint rules.
Add a slight delay to setActivityBody(newStringifiedBody) using setTimeout: This could mitigate the re-render issue without violating ESLint rules.
Bug Description
When dragging a block in the editor, the block is appending to the body.
https://github.com/user-attachments/assets/fb00a63e-9b43-46d3-9c68-8c156b44b551
Expected behavior
The block should not clutter the body upon being dragged.
Technical inputs
This issue is caused by
setActivityBody(newStringifiedBody)
in thehandleEditorChange
function within theRichTextEditor
component, which triggers re-renders causing the issue. Relevant CodeProposed Solutions
I have identified two potential solutions which works:
Use
useRef
instead ofuseRecoilState
for state management: This approach could prevent re-renders but may conflict with existing ESLint rules.Add a slight delay to
setActivityBody(newStringifiedBody)
usingsetTimeout
: This could mitigate the re-render issue without violating ESLint rules.Which one should I go ahead with?