From bb62dd751c8d0f29f2e447f4dfdb5769003961c7 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Thu, 2 Mar 2023 08:40:07 -0800 Subject: [PATCH 1/2] synchronize composer text between tabs --- src/pages/home/report/ReportActionCompose.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pages/home/report/ReportActionCompose.js b/src/pages/home/report/ReportActionCompose.js index dd6d208e1123..0be0635472b4 100644 --- a/src/pages/home/report/ReportActionCompose.js +++ b/src/pages/home/report/ReportActionCompose.js @@ -190,9 +190,13 @@ class ReportActionCompose extends React.Component { this.setMaxLines(); } + // 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. + const shouldSyncComment = prevProps.comment != this.props.comment && this.state.value != this.props.comment; + // As the report IDs change, make sure to update the composer comment as we need to make sure // we do not show incorrect data in there (ie. draft of message from other report). - if (this.props.report.reportID === prevProps.report.reportID) { + if (this.props.report.reportID === prevProps.report.reportID && !shouldSyncComment) { return; } From c8d3dcb75fe4da19a1e969876cfd347a1d706c05 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Thu, 2 Mar 2023 08:56:56 -0800 Subject: [PATCH 2/2] fix lint --- src/pages/home/report/ReportActionCompose.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/home/report/ReportActionCompose.js b/src/pages/home/report/ReportActionCompose.js index 0be0635472b4..9d52155eaf1b 100644 --- a/src/pages/home/report/ReportActionCompose.js +++ b/src/pages/home/report/ReportActionCompose.js @@ -192,7 +192,7 @@ class ReportActionCompose extends React.Component { // 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. - const shouldSyncComment = prevProps.comment != this.props.comment && this.state.value != this.props.comment; + const shouldSyncComment = prevProps.comment !== this.props.comment && this.state.value !== this.props.comment; // As the report IDs change, make sure to update the composer comment as we need to make sure // we do not show incorrect data in there (ie. draft of message from other report).