From 03b4f581d7e191a2d5f1bce4fb62ae934d686058 Mon Sep 17 00:00:00 2001 From: "Eugene Voloshchak (via MelvinBot)" Date: Thu, 5 Mar 2026 15:49:14 +0000 Subject: [PATCH 1/2] Show loading spinner instead of not-found page during Onyx pending merge for draft transactions When uploading an odometer photo and navigating to the receipt preview, Onyx.merge is async and useOnyx returns undefined while the merge is pending, causing shouldShowNotFoundPage to evaluate to true. This change checks the useOnyx fetch status for the transaction draft and shows a loading spinner during the pending merge instead of the "not here" page. Co-authored-by: Eugene Voloshchak --- .../routes/TransactionReceiptModalContent.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pages/media/AttachmentModalScreen/routes/TransactionReceiptModalContent.tsx b/src/pages/media/AttachmentModalScreen/routes/TransactionReceiptModalContent.tsx index 40029afef415..4d6b903515ab 100644 --- a/src/pages/media/AttachmentModalScreen/routes/TransactionReceiptModalContent.tsx +++ b/src/pages/media/AttachmentModalScreen/routes/TransactionReceiptModalContent.tsx @@ -33,6 +33,7 @@ import ROUTES from '@src/ROUTES'; import type SCREENS from '@src/SCREENS'; import type {ReceiptSource} from '@src/types/onyx/Transaction'; import type {FileObject} from '@src/types/utils/Attachment'; +import isLoadingOnyxValue from '@src/types/utils/isLoadingOnyxValue'; import useDownloadAttachment from './hooks/useDownloadAttachment'; function TransactionReceiptModalContent({navigation, route}: AttachmentModalScreenProps) { @@ -45,7 +46,7 @@ function TransactionReceiptModalContent({navigation, route}: AttachmentModalScre const [report] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`); const allTransactions = useAllTransactions(); const transactionMain = allTransactions?.[`${ONYXKEYS.COLLECTION.TRANSACTION}${getNonEmptyStringOnyxID(transactionID)}`]; - const [transactionDraft] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${getNonEmptyStringOnyxID(transactionID)}`); + const [transactionDraft, transactionDraftResult] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${getNonEmptyStringOnyxID(transactionID)}`); const [reportMetadata = CONST.DEFAULT_REPORT_METADATA] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_METADATA}${reportID}`); const [policyCategories] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${report?.policyID}`); const [session] = useOnyx(ONYXKEYS.SESSION); @@ -595,7 +596,7 @@ function TransactionReceiptModalContent({navigation, route}: AttachmentModalScre threeDotsMenuItems, isAuthTokenRequired, isTrackExpenseAction: isTrackExpenseActionValue, - isLoading: !transaction && reportMetadata?.isLoadingInitialReportActions, + isLoading: !transaction && (reportMetadata?.isLoadingInitialReportActions || (isDraftTransaction && isLoadingOnyxValue(transactionDraftResult))), shouldShowNotFoundPage, shouldShowCarousel: false, shouldShowRotateButton: false, @@ -616,6 +617,8 @@ function TransactionReceiptModalContent({navigation, route}: AttachmentModalScre isTrackExpenseActionValue, transaction, reportMetadata?.isLoadingInitialReportActions, + isDraftTransaction, + transactionDraftResult, shouldShowNotFoundPage, allowDownload, onDownloadAttachment, From d02ed8cd8d6cfcbce3a2d28f4d66b26c00041ff2 Mon Sep 17 00:00:00 2001 From: "Eugene Voloshchak (via MelvinBot)" Date: Thu, 5 Mar 2026 16:03:31 +0000 Subject: [PATCH 2/2] Fix: Use nullish coalescing operator instead of logical or Replace || with ?? for isLoadingInitialReportActions fallback to satisfy @typescript-eslint/prefer-nullish-coalescing rule. Co-authored-by: Eugene Voloshchak --- .../routes/TransactionReceiptModalContent.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/media/AttachmentModalScreen/routes/TransactionReceiptModalContent.tsx b/src/pages/media/AttachmentModalScreen/routes/TransactionReceiptModalContent.tsx index 4d6b903515ab..ec450ea2570f 100644 --- a/src/pages/media/AttachmentModalScreen/routes/TransactionReceiptModalContent.tsx +++ b/src/pages/media/AttachmentModalScreen/routes/TransactionReceiptModalContent.tsx @@ -596,7 +596,7 @@ function TransactionReceiptModalContent({navigation, route}: AttachmentModalScre threeDotsMenuItems, isAuthTokenRequired, isTrackExpenseAction: isTrackExpenseActionValue, - isLoading: !transaction && (reportMetadata?.isLoadingInitialReportActions || (isDraftTransaction && isLoadingOnyxValue(transactionDraftResult))), + isLoading: !transaction && (reportMetadata?.isLoadingInitialReportActions ?? (isDraftTransaction && isLoadingOnyxValue(transactionDraftResult))), shouldShowNotFoundPage, shouldShowCarousel: false, shouldShowRotateButton: false,