Skip to content
Merged
Show file tree
Hide file tree
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
12 changes: 11 additions & 1 deletion src/libs/ReportUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3382,7 +3382,16 @@ function shouldReportShowSubscript(report) {
* @returns {Boolean}
*/
function isReportDataReady() {
return !_.isEmpty(allReports) && _.some(_.keys(allReports), (key) => allReports[key].reportID);
return !_.isEmpty(allReports) && _.some(_.keys(allReports), (key) => allReports[key] && allReports[key].reportID);
}

/**
* Return true if reportID from path is valid
* @param {String} reportIDFromPath
* @returns {Boolean}
*/
function isValidReportIDFromPath(reportIDFromPath) {
return typeof reportIDFromPath === 'string' && !['', 'null', '0'].includes(reportIDFromPath);
}

/**
Expand Down Expand Up @@ -3764,6 +3773,7 @@ export {
isChildReport,
shouldReportShowSubscript,
isReportDataReady,
isValidReportIDFromPath,
isSettled,
isAllowedToComment,
getBankAccountRoute,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/home/ReportScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ function ReportScreen({

// Report ID will be empty when the reports collection is empty.
// This could happen when we are loading the collection for the first time after logging in.
if (!reportIDFromPath) {
if (!ReportUtils.isValidReportIDFromPath(reportIDFromPath)) {
return;
}

Expand Down