Skip to content
Merged
Show file tree
Hide file tree
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
9 changes: 8 additions & 1 deletion src/pages/Search/SearchMoneyRequestReportPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
}
Navigation.dismissModal();
}
}, [report]);

Check warning on line 100 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 @@ -261,7 +261,13 @@
// Create transaction thread for legacy transactions that don't have one yet.
// Wait for all data to load to avoid duplicates or stale data when navigating between reports.
useEffect(() => {
if (hasCreatedLegacyThreadRef.current || transactionThreadReportID || (Object.keys(allReportTransactions).length !== 1 && !snapshotTransaction)) {
if (
hasCreatedLegacyThreadRef.current ||
transactionThreadReportID ||
(Object.keys(allReportTransactions).length !== 1 && !snapshotTransaction) ||
!reportMetadata?.hasOnceLoadedReportActions ||
reportActions.length === 0
) {
return;
}

Expand Down Expand Up @@ -306,6 +312,7 @@
report,
reportActions,
reportIDFromRoute,
reportMetadata?.hasOnceLoadedReportActions,
reportMetadata?.isLoadingInitialReportActions,
snapshot,
snapshotTransaction,
Expand Down
18 changes: 16 additions & 2 deletions src/pages/inbox/ReportScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,9 @@ function ReportScreen({route, navigation, isInSidePanel = false}: ReportScreenPr
hasCreatedLegacyThreadRef.current ||
route.name === SCREENS.RIGHT_MODAL.SEARCH_REPORT ||
transactionThreadReport ||
(transactionThreadReportID && transactionThreadReportID !== '0')
(transactionThreadReportID && transactionThreadReportID !== '0') ||
!reportMetadata?.hasOnceLoadedReportActions ||
reportActions.length === 0
) {
return;
}
Expand All @@ -940,7 +942,19 @@ function ReportScreen({route, navigation, isInSidePanel = false}: ReportScreenPr
// For legacy transactions, pass undefined as IOU action and the transaction object
// It will be created optimistically and in the backend when call openReport
createTransactionThreadReport(introSelected, currentUserEmail ?? '', currentUserAccountID, report, undefined, transaction);
}, [introSelected, currentUserEmail, currentUserAccountID, report, visibleTransactions, transactionThreadReport, transactionThreadReportID, reportID, route.name]);
}, [
introSelected,
currentUserEmail,
currentUserAccountID,
report,
visibleTransactions,
transactionThreadReport,
transactionThreadReportID,
reportID,
route.name,
reportMetadata?.hasOnceLoadedReportActions,
reportActions.length,
]);

const lastRoute = usePrevious(route);

Expand Down
Loading