Skip to content
Merged
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
5 changes: 3 additions & 2 deletions src/pages/home/ReportScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ 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 @@ -171,6 +170,8 @@ 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 @@ -179,7 +180,7 @@ function ReportScreen({

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

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