Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CP Staging] Fixes not found page not being shown properly when not having access to report #28584

Merged
merged 6 commits into from
Oct 2, 2023
Merged
Changes from 3 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
26 changes: 4 additions & 22 deletions src/pages/home/ReportScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ const defaultProps = {
hasOutstandingIOU: false,
},
reportMetadata: {
isLoadingReportActions: false,
isLoadingReportActions: true,
isLoadingMoreReportActions: false,
},
isComposerFullSize: false,
Expand All @@ -118,15 +118,6 @@ const defaultProps = {
...withCurrentReportIDDefaultProps,
};

/**
*
* Function to check weather the report available in props is default
*
* @param {Object} report
* @returns {Boolean}
*/
const checkDefaultReport = (report) => report === defaultProps.report;

/**
* Get the currently viewed report ID as number
*
Expand Down Expand Up @@ -188,8 +179,6 @@ function ReportScreen({
const isTopMostReportId = currentReportID === getReportID(route);
const didSubscribeToReportLeavingEvents = useRef(false);

const isDefaultReport = checkDefaultReport(report);

let headerView = (
<HeaderView
reportID={reportID}
Expand Down Expand Up @@ -365,16 +354,9 @@ function ReportScreen({
// eslint-disable-next-line rulesdir/no-negated-variables
const shouldShowNotFoundPage = useMemo(
() =>
(!firstRenderRef.current &&
!_.isEmpty(report) &&
!isDefaultReport &&
!report.reportID &&
!isOptimisticDelete &&
!report.isLoadingReportActions &&
!isLoading &&
!userLeavingStatus) ||
(!firstRenderRef.current && !_.isEmpty(report) && !report.reportID && !isOptimisticDelete && !reportMetadata.isLoadingReportActions && !isLoading && !userLeavingStatus) ||
shouldHideReport,
[report, isLoading, shouldHideReport, isDefaultReport, isOptimisticDelete, userLeavingStatus],
[report, reportMetadata, isLoading, shouldHideReport, isOptimisticDelete, userLeavingStatus],
);

return (
Expand Down Expand Up @@ -486,7 +468,7 @@ export default compose(
reportMetadata: {
key: ({route}) => `${ONYXKEYS.COLLECTION.REPORT_METADATA}${getReportID(route)}`,
initialValue: {
isLoadingReportActions: false,
isLoadingReportActions: true,
isLoadingMoreReportActions: false,
},
},
Expand Down