diff --git a/src/pages/home/report/ReportActionsView.js b/src/pages/home/report/ReportActionsView.js index aece1b7885f8..98a4825cb4d0 100755 --- a/src/pages/home/report/ReportActionsView.js +++ b/src/pages/home/report/ReportActionsView.js @@ -209,7 +209,7 @@ class ReportActionsView extends React.Component { // Only update the unread count when MarkerBadge is visible // Otherwise marker will be shown on scrolling up from the bottom even if user have read those messages if (this.state.isMarkerActive) { - this.updateLocalUnreadActionCount(); + this.updateLocalUnreadActionCount(!shouldRecordMaxAction); } // show new MarkerBadge when there is a new message @@ -389,9 +389,14 @@ class ReportActionsView extends React.Component { /** * Update the unread messages count to show in the MarkerBadge + * @param {Boolean} [shouldResetLocalCount=false] Whether count should increment or reset */ - updateLocalUnreadActionCount() { - this.setState(prevState => ({localUnreadActionCount: prevState.localUnreadActionCount + this.props.report.unreadActionCount})); + updateLocalUnreadActionCount(shouldResetLocalCount = false) { + this.setState(prevState => ({ + localUnreadActionCount: shouldResetLocalCount + ? this.props.report.unreadActionCount + : prevState.localUnreadActionCount + this.props.report.unreadActionCount, + })); } /**