Skip to content

Commit

Permalink
Prevent saving the same value in Onyx
Browse files Browse the repository at this point in the history
  • Loading branch information
marktoman committed Oct 30, 2021
1 parent eda9eb8 commit 302e018
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/pages/home/report/ReportActionCompose.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,18 @@ class ReportActionCompose extends React.Component {
this.setState({
isCommentEmpty: newComment.length === 0,
});

// Indicate that draft has been created.
if (this.comment.length === 0 && newComment.length !== 0) {
setReportWithDraft(this.props.reportID.toString(), true);
}

// The draft has been deleted.
if (newComment.length === 0) {
setReportWithDraft(this.props.reportID.toString(), false);
}

this.comment = newComment;
setReportWithDraft(this.props.reportID.toString(), newComment.length !== 0);
this.debouncedSaveReportComment(newComment);
if (newComment) {
this.debouncedBroadcastUserIsTyping();
Expand Down

0 comments on commit 302e018

Please sign in to comment.