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
29 changes: 20 additions & 9 deletions src/pages/home/ReportScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,12 @@ function ReportScreen({route, navigation}: ReportScreenProps) {
return;
}

// If there is one transaction thread that has not yet been created, we should create it.
if (transactionThreadReportID === CONST.FAKE_REPORT_ID && !transactionThreadReport) {
createOneTransactionThreadReport();
return;
}

// When a user goes through onboarding for the first time, various tasks are created for chatting with Concierge.
// If this function is called too early (while the application is still loading), we will not have information about policies,
// which means we will not be able to obtain the correct link for one of the tasks.
Expand All @@ -539,7 +545,20 @@ function ReportScreen({route, navigation}: ReportScreenProps) {
}

openReport(reportIDFromRoute, reportActionIDFromRoute);
}, [reportMetadata.isOptimisticReport, report, isOffline, isLoadingApp, introSelected, isOnboardingCompleted, isInviteOnboardingComplete, reportIDFromRoute, reportActionIDFromRoute]);
}, [
reportMetadata.isOptimisticReport,
report,
isOffline,
transactionThreadReportID,
transactionThreadReport,
reportIDFromRoute,
reportActionIDFromRoute,
createOneTransactionThreadReport,
isLoadingApp,
introSelected,
isOnboardingCompleted,
isInviteOnboardingComplete,
]);

useEffect(() => {
if (!isAnonymousUser) {
Expand All @@ -548,14 +567,6 @@ function ReportScreen({route, navigation}: ReportScreenProps) {
prevIsAnonymousUser.current = true;
}, [isAnonymousUser]);

useEffect(() => {
if (transactionThreadReportID !== CONST.FAKE_REPORT_ID || transactionThreadReportID || !reportMetadata.hasOnceLoadedReportActions) {
return;
}

createOneTransactionThreadReport();
}, [reportMetadata.hasOnceLoadedReportActions, transactionThreadReportID, createOneTransactionThreadReport]);

useEffect(() => {
if (isLoadingReportData || !prevIsLoadingReportData || !prevIsAnonymousUser.current || isAnonymousUser) {
return;
Expand Down
Loading