Skip to content

Commit

Permalink
Improve code style
Browse files Browse the repository at this point in the history
  • Loading branch information
marktoman committed Nov 3, 2021
1 parent d680ff8 commit dd4cd8a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/pages/home/sidebar/SidebarLinks.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class SidebarLinks extends React.Component {
}

static getUnreadReports(reportsObject) {
const reports = _.values(reportsObject || {});
const reports = _.values(reportsObject);
if (reports.length === 0) {
return [];
}
Expand Down Expand Up @@ -136,7 +136,7 @@ class SidebarLinks extends React.Component {
}

// If any reports have new unread messages, re-order the list
const nextUnreadReports = SidebarLinks.getUnreadReports(nextProps.reports);
const nextUnreadReports = SidebarLinks.getUnreadReports(nextProps.reports || {});
const hasNewUnreadReports = nextUnreadReports.length > 0
&& _.some(nextUnreadReports,
nextUnreadReport => !_.some(unreadReports, unreadReport => unreadReport.reportID === nextUnreadReport.reportID));
Expand All @@ -158,7 +158,7 @@ class SidebarLinks extends React.Component {
this.state = {
currentlyViewedReportID: props.currentlyViewedReportID,
orderedReports: [],
unreadReports: SidebarLinks.getUnreadReports(props.reports),
unreadReports: SidebarLinks.getUnreadReports(props.reports || {}),
};
}

Expand All @@ -176,7 +176,7 @@ class SidebarLinks extends React.Component {
return {
orderedReports,
currentlyViewedReportID: nextProps.currentlyViewedReportID,
unreadReports: SidebarLinks.getUnreadReports(nextProps.reports),
unreadReports: SidebarLinks.getUnreadReports(nextProps.reports || {}),
};
}

Expand All @@ -194,7 +194,7 @@ class SidebarLinks extends React.Component {
const sections = [{
title: '',
indexOffset: 0,
data: this.state.orderedReports ?? [],
data: this.state.orderedReports || [],
shouldShow: true,
}];

Expand Down

0 comments on commit dd4cd8a

Please sign in to comment.