Skip to content
Open
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
10 changes: 9 additions & 1 deletion src/pages/Search/SearchMoneyRequestReportPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import WideRHPOverlayWrapper from '@components/WideRHPOverlayWrapper';
import useActionListContextValue from '@hooks/useActionListContextValue';
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
import useDocumentTitle from '@hooks/useDocumentTitle';
import useIsReportReadyToDisplay from '@hooks/useIsReportReadyToDisplay';
import useNetwork from '@hooks/useNetwork';
import useOnyx from '@hooks/useOnyx';
Expand All @@ -36,6 +37,7 @@
getReportAction,
isMoneyRequestAction,
} from '@libs/ReportActionsUtils';
import {getReportName} from '@libs/ReportNameUtils';
import {isMoneyRequestReport, isMoneyRequestReportPendingDeletion, isValidReportIDFromPath} from '@libs/ReportUtils';
import {cancelSpansByPrefix} from '@libs/telemetry/activeSpans';
import {doesDeleteNavigateBackUrlIncludeDuplicatesReview, getParentReportActionDeletionStatus, hasLoadedReportActions, isThreadReportDeleted} from '@libs/TransactionNavigationUtils';
Expand All @@ -47,7 +49,8 @@
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import SCREENS from '@src/SCREENS';
import type {PersonalDetailsList, Policy, Transaction, TransactionViolations} from '@src/types/onyx';
import {reportByIDsSelector} from '@src/selectors/Attributes';
import type {PersonalDetailsList, Policy, ReportAttributesDerivedValue, Transaction, TransactionViolations} from '@src/types/onyx';
import {getEmptyObject} from '@src/types/utils/EmptyObject';

type SearchMoneyRequestPageProps =
Expand Down Expand Up @@ -106,7 +109,7 @@
}
Navigation.dismissModal();
}
}, [report]);

Check warning on line 112 in src/pages/Search/SearchMoneyRequestReportPage.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

React Hook useEffect has missing dependencies: 'isFocused' and 'prevReport'. Either include them or remove the dependency array

useEffect(() => {
// Update last visit time when the expense super wide RHP report is focused
Expand Down Expand Up @@ -159,6 +162,11 @@
const oneTransactionID = reportTransactions.at(0)?.transactionID;

const reportID = report?.reportID;

const reportAttributesSelector = useCallback((attributes: OnyxEntry<ReportAttributesDerivedValue>) => reportByIDsSelector(reportID ? [reportID] : [])(attributes), [reportID]);
const [reportAttributes] = useOnyx(ONYXKEYS.DERIVED.REPORT_ATTRIBUTES, {selector: reportAttributesSelector});
useDocumentTitle(getReportName(report, reportAttributes));

const doesReportIDLookValid = isValidReportIDFromPath(reportID);
const hasLoadedReportActionsForAccessError = hasLoadedReportActions(reportMetadata, isOffline);
const isReportPendingDeletion = isMoneyRequestReportPendingDeletion(report);
Expand Down
Loading