diff --git a/src/pages/home/ReportScreen.js b/src/pages/home/ReportScreen.js index 51981d5fe80e..4903ab2160a5 100644 --- a/src/pages/home/ReportScreen.js +++ b/src/pages/home/ReportScreen.js @@ -127,7 +127,7 @@ const defaultProps = { * @returns {String} */ function getReportID(route) { - return String(lodashGet(route, 'params.reportID', null)); + return String(lodashGet(route, 'params.reportID', '')); } function ReportScreen({ @@ -340,6 +340,9 @@ function ReportScreen({ }, [route, report, errors, fetchReportIfNeeded, prevReport.reportID, prevUserLeavingStatus, userLeavingStatus, prevReport.statusNum, prevReport.parentReportID]); useEffect(() => { + if (!ReportUtils.isValidReportIDFromPath(reportID)) { + return; + } // Ensures subscription event succeeds when the report/workspace room is created optimistically. // Check if the optimistic `OpenReport` or `AddWorkspaceRoom` has succeeded by confirming // any `pendingFields.createChat` or `pendingFields.addWorkspaceRoom` fields are set to null.