Skip to content

Commit

Permalink
Merge pull request #45224 from Expensify/francois-fix-blocker-45212
Browse files Browse the repository at this point in the history
[CP Staging] Fix default chat report view not loading upon signin
  • Loading branch information
srikarparsi authored Jul 11, 2024
2 parents 50d7409 + c5dc961 commit 63e9e7b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/pages/home/ReportScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ function ReportScreen({

const isLoadingReportOnyx = isLoadingOnyxValue(reportResult);
const permissions = useDeepCompareRef(reportOnyx?.permissions);
const lastAccessedReportID = ReportUtils.findLastAccessedReport(!canUseDefaultRooms, !!route.params.openOnAdminRoom, activeWorkspaceID)?.reportID;

useEffect(() => {
// Don't update if there is a reportID in the params already
Expand All @@ -183,8 +184,6 @@ function ReportScreen({
return;
}

const lastAccessedReportID = ReportUtils.findLastAccessedReport(!canUseDefaultRooms, !!route.params.openOnAdminRoom, activeWorkspaceID)?.reportID;

// It's possible that reports aren't fully loaded yet
// in that case the reportID is undefined
if (!lastAccessedReportID) {
Expand All @@ -193,7 +192,7 @@ function ReportScreen({

Log.info(`[ReportScreen] no reportID found in params, setting it to lastAccessedReportID: ${lastAccessedReportID}`);
navigation.setParams({reportID: lastAccessedReportID});
}, [activeWorkspaceID, canUseDefaultRooms, navigation, route]);
}, [lastAccessedReportID, activeWorkspaceID, canUseDefaultRooms, navigation, route]);

/**
* Create a lightweight Report so as to keep the re-rendering as light as possible by
Expand Down

0 comments on commit 63e9e7b

Please sign in to comment.