From 7cf63078336ee392087dbf94a9de5917692a81c7 Mon Sep 17 00:00:00 2001 From: Rory Abraham <47436092+roryabraham@users.noreply.github.com> Date: Fri, 27 Aug 2021 09:59:53 -0700 Subject: [PATCH] Merge pull request #4865 from parasharrajat/markercount fix count when LHN is open on mobile (cherry picked from commit 7e556357b4783f1411bfd1e9febbd1705ba78c08) --- src/pages/home/report/ReportActionsView.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/pages/home/report/ReportActionsView.js b/src/pages/home/report/ReportActionsView.js index f7726b0ca40..058fd4d45c9 100755 --- a/src/pages/home/report/ReportActionsView.js +++ b/src/pages/home/report/ReportActionsView.js @@ -210,7 +210,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 @@ -390,9 +390,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, + })); } /**