Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix count when LHN is open on mobile #4865

Merged
merged 2 commits into from
Aug 27, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/pages/home/report/ReportActionsView.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
}));
}

/**
Expand Down