Skip to content

Commit

Permalink
chore: add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
meetmangukiya committed Oct 21, 2021
1 parent 17755bf commit 1ed0e98
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/pages/home/sidebar/SidebarLinks.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,16 @@ const defaultProps = {

class SidebarLinks extends React.Component {
shouldComponentUpdate(nextProps) {
// We do not want to re-order reports in the LHN if the only change is the draft comment in the
// current report.

// We don't need to limit draft comment flashing for small screen widths as LHN is not visible.
if (nextProps.isSmallScreenWidth) {
return true;
}

const didActiveReportChange = this.props.currentlyViewedReportID !== nextProps.currentlyViewedReportID;
// Always re-order the list whenever the active report is changed
if (didActiveReportChange) {
return true;
}
Expand Down Expand Up @@ -144,6 +148,7 @@ class SidebarLinks extends React.Component {
const activeReportID = this.props.currentlyViewedReportID;
const reportKey = `${ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT}${activeReportID}`;

// Do not re-order reports if draft comment changes are only in the current report.
if (allReportsWithDraftCommentChanges.length === 1 && allReportsWithDraftCommentChanges.includes(reportKey)) {
return false;
}
Expand Down

0 comments on commit 1ed0e98

Please sign in to comment.