Skip to content

Commit

Permalink
Merge pull request #30301 from s-alves10/fix/issue-28265
Browse files Browse the repository at this point in the history
  • Loading branch information
dangrous authored Oct 26, 2023
2 parents a5e1e3f + 12b88e3 commit b335f2f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ function SilentCommentUpdater({comment, commentRef, report, value, updateComment
const {preferredLocale} = useLocalize();
const prevPreferredLocale = usePrevious(preferredLocale);

useEffect(() => {
updateComment(comment);
// eslint-disable-next-line react-hooks/exhaustive-deps -- We need to run this on mount
}, []);

useEffect(() => {
// Value state does not have the same value as comment props when the comment gets changed from another tab.
// In this case, we should synchronize the value between tabs.
Expand Down
5 changes: 5 additions & 0 deletions src/pages/home/report/ReportActionItemMessageEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,11 @@ function ReportActionItemMessageEdit(props) {
[props.action.message, debouncedSaveDraft, debouncedUpdateFrequentlyUsedEmojis, props.preferredSkinTone, preferredLocale],
);

useEffect(() => {
updateDraft(draft);
// eslint-disable-next-line react-hooks/exhaustive-deps -- run this only when language is changed
}, [props.action.reportActionID, preferredLocale]);

/**
* Delete the draft of the comment being edited. This will take the comment out of "edit mode" with the old content.
*/
Expand Down

0 comments on commit b335f2f

Please sign in to comment.