From feb5df2da15bd2ea26cb41b2ac0fac79e933daa9 Mon Sep 17 00:00:00 2001 From: Grigory Zaytsev Date: Tue, 26 Mar 2024 22:47:48 +0100 Subject: [PATCH] fix edit message draft reappearing --- src/pages/home/report/ReportActionItemMessageEdit.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/home/report/ReportActionItemMessageEdit.tsx b/src/pages/home/report/ReportActionItemMessageEdit.tsx index 22dcdce4eb11..d5e73192772e 100644 --- a/src/pages/home/report/ReportActionItemMessageEdit.tsx +++ b/src/pages/home/report/ReportActionItemMessageEdit.tsx @@ -221,6 +221,8 @@ function ReportActionItemMessageEdit( }, 1000), [reportID, action], ); + + useEffect(() => () => debouncedSaveDraft.cancel()) /** * Update frequently used emojis list. We debounce this method in the constructor so that UpdateFrequentlyUsedEmojis @@ -280,7 +282,6 @@ function ReportActionItemMessageEdit( * Delete the draft of the comment being edited. This will take the comment out of "edit mode" with the old content. */ const deleteDraft = useCallback(() => { - debouncedSaveDraft.cancel(); Report.deleteReportActionDraft(reportID, action); if (isActive()) {