You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[$250] Odometer - Not here page opens after uploading odometer photo/opening uploaded photo #82661
Version Number: 9.3.20-4 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack:#80532 Email or phone of affected tester (no customers):applausetester+ihbuiivyw@applause.expensifail.com Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: Mac 26.2 / Chrome App Component: Money Requests
Action Performed:
Precondition:
Log in with Expensifail account.
Go to staging.new.expensify.com
Go to workspace chat.
Create an odometer expense.
Open the expense.
Click Distance.
Click image thumbnail next to Start reading.
Upload a photo.
Click RHP back button.
Click image thumbnail next to Start reading.
Expected Result:
In Step 7, after uploading photo, RHP will return to Distance page.
In Step 9, receipt will open in full screen.
Actual Result:
In Step 7, after uploading photo, RHP opens not here page.
In Step 9, not here page opens in full screen.
Summary: After uploading an odometer photo in the EDIT flow, the RHP shows a "not here" page instead of returning to the Distance page. Clicking the image thumbnail afterward also shows "not here" in full screen.
Confidence: Medium — code evidence supports the hypothesis, but runtime confirmation would strengthen it.
Proposal
Please re-state the problem that we are trying to solve in this issue.
When editing an existing odometer expense (open expense → click Distance → click image thumbnail → upload photo), two things go wrong:
After uploading the photo, the RHP shows a "not here" (not-found) page instead of returning to the Distance/Odometer page.
Clicking the image thumbnail again opens the "not here" page in full screen instead of showing the uploaded receipt.
What is the root cause of that problem?
The root cause is in TransactionReceiptModalContent.tsx:217-218. The shouldShowNotFoundPage logic:
When isDraftTransaction is true (which it is whenever action is provided — including the edit action at line 60: const isDraftTransaction = !!action), the page shows "not here" when !transaction is true — i.e., when the transaction draft doesn't exist.
During the edit flow for an existing odometer expense, the TransactionReceiptModalContent reads the transaction from ONYXKEYS.COLLECTION.TRANSACTION_DRAFT (line 48), because isDraftTransaction = true. However, the edit flow for the distance/odometer step may not properly create a transaction draft for the given transactionID. Additionally, when setMoneyRequestOdometerImage is called during the upload (at IOU/index.ts:1769), it creates only a minimal draft containing just {comment: {odometerStartImage: ...}} via Onyx.merge — but this minimal draft may not satisfy all the conditions downstream.
A contributing factor is the withWritableReportOrNotFound HOC wrapping IOURequestStepDistanceOdometer (IOURequestStepDistanceOdometer.tsx:666). This HOC calls canUserPerformWriteAction(report ?? {reportID: ''}, isReportArchived) at withWritableReportOrNotFound.tsx:95. If the report is momentarily unavailable in Onyx during navigation transitions, this returns false and renders <FullPageNotFoundView> — the "not here" page.
What changes do you think we should make in order to solve the problem?
Two fixes are needed:
In TransactionReceiptModalContent.tsx — When isDraftTransaction is true and the transaction draft is not found, fall back to the main transaction (transactionMain) instead of immediately showing the not-found page. The shouldShowNotFoundPage logic should consider both the draft and the main transaction:
Check !transaction should become !transaction && !transactionMain (or similar), so that when viewing an odometer image during edit, the existing transaction can be used as a fallback.
In IOURequestStepDistanceOdometer.tsx / the edit flow — Ensure the transaction draft is properly initialized when entering the distance/odometer edit step. When the user navigates to edit the distance of an existing expense, the full transaction data should be copied into TRANSACTION_DRAFT so that downstream components (receipt preview, odometer image) can find it.
What alternative solutions did you explore? (Optional)
Adding a loading state guard in TransactionReceiptModalContent when isDraftTransaction is true but the draft hasn't loaded yet. However, this only addresses the race condition symptom, not the underlying missing draft issue.
Changing withWritableReportOrNotFound to be more lenient during the edit flow (e.g., skip the canUserPerformWriteAction check when action === 'edit'). This is too broad and could mask real access issues.
Component chain for IOURequestStepOdometerImage: withFullTransactionOrNotFound → IOURequestStepOdometerImage (line 518 of index.tsx)
Key observations:
withFullTransactionOrNotFound (withFullTransactionOrNotFound.tsx:85-90) only shows not-found when transactionID route param is falsy. It does NOT check if the transaction object itself exists in Onyx. So even if the draft is missing, this HOC passes through.
withWritableReportOrNotFound (withWritableReportOrNotFound.tsx:95-97) shows not-found when canUserPerformWriteAction returns false. This calls canUserPerformWriteAction(report ?? {reportID: ''}, isReportArchived) (ReportUtils.ts:10086-10094). If report is null/undefined, the fallback {reportID: ''} makes canUserPerformWriteAction return false because the report && check at line 10094 fails.
The receipt preview shouldShowNotFoundPage logic (TransactionReceiptModalContent.tsx:217-218) evaluates to !transaction when isDraftTransaction = true. The transaction comes from transactionDraft (line 64-66), which is fetched from ONYXKEYS.COLLECTION.TRANSACTION_DRAFT.
setMoneyRequestOdometerImage (IOU/index.ts:1755-1774) stores the image via Onyx.merge into the draft. If the draft didn't exist before, this creates a minimal object with just the image data.
The MONEY_REQUEST_RECEIPT_PREVIEW route type definition (Navigation/types.ts:2923-2929) does NOT include imageType in its params, while TRANSACTION_RECEIPT does (line 2921). The imageType is passed as a query parameter in the URL, which React Navigation parses into route params at runtime, so it works functionally but is a type inconsistency.
IOURequestStepDistanceOdometer loads with action = 'edit', isDraft = true
withFullTransactionOrNotFound reads from TRANSACTION_DRAFT_{transactionID} → may be undefined if draft wasn't created
User clicks image thumbnail → navigates to IOURequestStepOdometerImage
User uploads photo → setMoneyRequestOdometerImage creates minimal draft via Onyx.merge
navigateBack() returns to distance odometer page
withWritableReportOrNotFound re-evaluates → if report is momentarily unavailable, shows "not here"
If user clicks image thumbnail → navigates to MONEY_REQUEST_RECEIPT_PREVIEW → TransactionReceiptModalContent loads → isDraftTransaction = true → transaction = transactionDraft (minimal draft or undefined) → shouldShowNotFoundPage may be true
changed the title [-]Odometer - Not here page opens after uploading odometer photo/opening uploaded photo[/-][+][$250] Odometer - Not here page opens after uploading odometer photo/opening uploaded photo[/+]on Mar 3, 2026
After deeper investigation, the primary root cause is a race condition between Onyx.merge and useOnyx in the receipt preview flow:
When the user uploads an odometer photo, setMoneyRequestOdometerImage (IOU/index.ts:1769) calls Onyx.merge to store the image in the transaction draft.
Onyx.merge is asynchronous — it adds to the internal mergeQueue and starts an async get() from storage (Onyx.js:216-217). The merge stays pending until the storage read completes.
When the user then clicks the image thumbnail (or when navigation returns), TransactionReceiptModalContent mounts and calls useOnyx for the transaction draft (TransactionReceiptModalContent.tsx:48).
useOnyx detects the pending merge via hasPendingMergeForKey() and deliberately returns undefined to avoid stale data (useOnyx.js:204-206):
With transaction = undefined, the shouldShowNotFoundPage logic (TransactionReceiptModalContent.tsx:217-218) evaluates to !undefined = true.
The isLoading guard doesn't protect against this because it only checks reportMetadata?.isLoadingInitialReportActions (line 598), NOT the useOnyx loading status for the draft transaction.
Recommended fix (refined):
Option A: Add allowStaleData: true to the useOnyx call for transactionDraft in TransactionReceiptModalContent — this prevents useOnyx from returning undefined when there's a pending merge.
Option B: Update the isLoading calculation to also check the useOnyx fetch status for the draft transaction, so it shows a loading spinner instead of "not here" while the merge is pending.
Option C: Also add imageType to the SCREENS.MONEY_REQUEST.RECEIPT_PREVIEW type definition in Navigation/types.ts:2923-2929 to fix the TypeScript gap (it's currently only in TRANSACTION_RECEIPT at line 2921).
This isn't reproducible after #82305 has been merged, now we just hide the ability to upload the image after odometer expense has been submitted. Melving does say that this is still reproducible (#84291 (comment)), but it isn't based on my testing.
I think we might want to close this
However, I did discover another bug while testing this:
Click FAB -> Track distance -> Odometer
Enter start and end readings, upload at least one image
Click Next -> Select a workspace.
Click on Distance menu item
Upload another image (either replace the original one or add a second one)
@eVoloshchak , can you report the bug in #expensify-open-source ? Post in the thread asking to be assigned and cc me plz.
Unsure on payment... pre-Melvin we had
50% to the contributor and C+ if they were 🎀👀🎀, hired, or assigned.
I'm fine with that for now cuz @eVoloshchak invested time. My concern, going forward, is that we're setting precedence with Melv issues that, if they draft a PR paymente is due, even if the C+ only put in minimal time. Reckon we shoudl address that soon.
Activity
melvin-bot commentedon Mar 3, 2026
Triggered auto assignment to @brianlee-expensify (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.MelvinBot commentedon Mar 3, 2026
🔍 Issue Analysis
Summary: After uploading an odometer photo in the EDIT flow, the RHP shows a "not here" page instead of returning to the Distance page. Clicking the image thumbnail afterward also shows "not here" in full screen.
Confidence: Medium — code evidence supports the hypothesis, but runtime confirmation would strengthen it.
Proposal
Please re-state the problem that we are trying to solve in this issue.
When editing an existing odometer expense (open expense → click Distance → click image thumbnail → upload photo), two things go wrong:
What is the root cause of that problem?
The root cause is in
TransactionReceiptModalContent.tsx:217-218. TheshouldShowNotFoundPagelogic:When
isDraftTransactionistrue(which it is wheneveractionis provided — including theeditaction at line 60:const isDraftTransaction = !!action), the page shows "not here" when!transactionis true — i.e., when the transaction draft doesn't exist.During the edit flow for an existing odometer expense, the
TransactionReceiptModalContentreads the transaction fromONYXKEYS.COLLECTION.TRANSACTION_DRAFT(line 48), becauseisDraftTransaction = true. However, the edit flow for the distance/odometer step may not properly create a transaction draft for the giventransactionID. Additionally, whensetMoneyRequestOdometerImageis called during the upload (atIOU/index.ts:1769), it creates only a minimal draft containing just{comment: {odometerStartImage: ...}}viaOnyx.merge— but this minimal draft may not satisfy all the conditions downstream.A contributing factor is the
withWritableReportOrNotFoundHOC wrappingIOURequestStepDistanceOdometer(IOURequestStepDistanceOdometer.tsx:666). This HOC callscanUserPerformWriteAction(report ?? {reportID: ''}, isReportArchived)atwithWritableReportOrNotFound.tsx:95. If the report is momentarily unavailable in Onyx during navigation transitions, this returnsfalseand renders<FullPageNotFoundView>— the "not here" page.What changes do you think we should make in order to solve the problem?
Two fixes are needed:
In
TransactionReceiptModalContent.tsx— WhenisDraftTransactionis true and the transaction draft is not found, fall back to the main transaction (transactionMain) instead of immediately showing the not-found page. TheshouldShowNotFoundPagelogic should consider both the draft and the main transaction:!transactionshould become!transaction && !transactionMain(or similar), so that when viewing an odometer image during edit, the existing transaction can be used as a fallback.In
IOURequestStepDistanceOdometer.tsx/ the edit flow — Ensure the transaction draft is properly initialized when entering the distance/odometer edit step. When the user navigates to edit the distance of an existing expense, the full transaction data should be copied intoTRANSACTION_DRAFTso that downstream components (receipt preview, odometer image) can find it.What alternative solutions did you explore? (Optional)
TransactionReceiptModalContentwhenisDraftTransactionis true but the draft hasn't loaded yet. However, this only addresses the race condition symptom, not the underlying missing draft issue.withWritableReportOrNotFoundto be more lenient during the edit flow (e.g., skip thecanUserPerformWriteActioncheck whenaction === 'edit'). This is too broad and could mask real access issues.Detailed Investigation
Root Cause Analysis
Component chain for
IOURequestStepDistanceOdometer:withFullTransactionOrNotFound→withWritableReportOrNotFound→withCurrentUserPersonalDetails→IOURequestStepDistanceOdometer(lines 664-670)Component chain for
IOURequestStepOdometerImage:withFullTransactionOrNotFound→IOURequestStepOdometerImage(line 518 of index.tsx)Key observations:
withFullTransactionOrNotFound(withFullTransactionOrNotFound.tsx:85-90) only shows not-found whentransactionIDroute param is falsy. It does NOT check if the transaction object itself exists in Onyx. So even if the draft is missing, this HOC passes through.withWritableReportOrNotFound(withWritableReportOrNotFound.tsx:95-97) shows not-found whencanUserPerformWriteActionreturns false. This callscanUserPerformWriteAction(report ?? {reportID: ''}, isReportArchived)(ReportUtils.ts:10086-10094). Ifreportis null/undefined, the fallback{reportID: ''}makescanUserPerformWriteActionreturn false because thereport &&check at line 10094 fails.The receipt preview
shouldShowNotFoundPagelogic (TransactionReceiptModalContent.tsx:217-218) evaluates to!transactionwhenisDraftTransaction = true. Thetransactioncomes fromtransactionDraft(line 64-66), which is fetched fromONYXKEYS.COLLECTION.TRANSACTION_DRAFT.setMoneyRequestOdometerImage(IOU/index.ts:1755-1774) stores the image viaOnyx.mergeinto the draft. If the draft didn't exist before, this creates a minimal object with just the image data.The
MONEY_REQUEST_RECEIPT_PREVIEWroute type definition (Navigation/types.ts:2923-2929) does NOT includeimageTypein its params, whileTRANSACTION_RECEIPTdoes (line 2921). TheimageTypeis passed as a query parameter in the URL, which React Navigation parses into route params at runtime, so it works functionally but is a type inconsistency.Evidence Chain
IOURequestStepDistanceOdometerloads withaction = 'edit',isDraft = truewithFullTransactionOrNotFoundreads fromTRANSACTION_DRAFT_{transactionID}→ may beundefinedif draft wasn't createdIOURequestStepOdometerImagesetMoneyRequestOdometerImagecreates minimal draft viaOnyx.mergenavigateBack()returns to distance odometer pagewithWritableReportOrNotFoundre-evaluates → if report is momentarily unavailable, shows "not here"MONEY_REQUEST_RECEIPT_PREVIEW→TransactionReceiptModalContentloads →isDraftTransaction = true→transaction = transactionDraft(minimal draft or undefined) →shouldShowNotFoundPagemay be trueRelevant Code
App/src/pages/media/AttachmentModalScreen/routes/TransactionReceiptModalContent.tsx:217-218-shouldShowNotFoundPagelogicApp/src/pages/iou/request/step/IOURequestStepDistanceOdometer.tsx:343-351-handleViewOdometerImagenavigationApp/src/pages/iou/request/step/IOURequestStepDistanceOdometer.tsx:664-670- HOC wrapping chainApp/src/pages/iou/request/step/IOURequestStepOdometerImage/index.tsx:80-90- Upload and navigateBack flowApp/src/pages/iou/request/step/withWritableReportOrNotFound.tsx:95-97- Report writability checkApp/src/pages/iou/request/step/withFullTransactionOrNotFound.tsx:85-90- Transaction existence checkApp/src/libs/actions/IOU/index.ts:1755-1774-setMoneyRequestOdometerImagefunctionApp/src/ROUTES.ts:1121-1131-MONEY_REQUEST_RECEIPT_PREVIEWroute definitionNext Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR, or@MelvinBot <your feedback>to refine this analysis.melvin-bot commentedon Mar 3, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @eVoloshchak (
External)[-]Odometer - Not here page opens after uploading odometer photo/opening uploaded photo[/-][+][$250] Odometer - Not here page opens after uploading odometer photo/opening uploaded photo[/+]melvin-bot commentedon Mar 3, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022028954847238304361
MelvinBot commentedon Mar 3, 2026
Update — More Precise Root Cause Identified:
After deeper investigation, the primary root cause is a race condition between
Onyx.mergeanduseOnyxin the receipt preview flow:setMoneyRequestOdometerImage(IOU/index.ts:1769) callsOnyx.mergeto store the image in the transaction draft.Onyx.mergeis asynchronous — it adds to the internalmergeQueueand starts an asyncget()from storage (Onyx.js:216-217). The merge stays pending until the storage read completes.TransactionReceiptModalContentmounts and callsuseOnyxfor the transaction draft (TransactionReceiptModalContent.tsx:48).useOnyxdetects the pending merge viahasPendingMergeForKey()and deliberately returnsundefinedto avoid stale data (useOnyx.js:204-206):transaction = undefined, theshouldShowNotFoundPagelogic (TransactionReceiptModalContent.tsx:217-218) evaluates to!undefined = true.isLoadingguard doesn't protect against this because it only checksreportMetadata?.isLoadingInitialReportActions(line 598), NOT theuseOnyxloading status for the draft transaction.Recommended fix (refined):
allowStaleData: trueto theuseOnyxcall fortransactionDraftinTransactionReceiptModalContent— this preventsuseOnyxfrom returningundefinedwhen there's a pending merge.isLoadingcalculation to also check theuseOnyxfetch status for the draft transaction, so it shows a loading spinner instead of "not here" while the merge is pending.imageTypeto theSCREENS.MONEY_REQUEST.RECEIPT_PREVIEWtype definition inNavigation/types.ts:2923-2929to fix the TypeScript gap (it's currently only inTRANSACTION_RECEIPTat line 2921).eVoloshchak commentedon Mar 5, 2026
@MelvinBot, implement this, let's go with option B
MelvinBot commentedon Mar 5, 2026
Draft PR created: #84291
Please mark it as "Ready for review" when it is ready for review.
eVoloshchak commentedon Mar 9, 2026
This isn't reproducible after #82305 has been merged, now we just hide the ability to upload the image after odometer expense has been submitted. Melving does say that this is still reproducible (#84291 (comment)), but it isn't based on my testing.
I think we might want to close this
However, I did discover another bug while testing this:
Screen.Recording.2026-03-09.at.18.01.01.mov
cc: @brianlee-expensify
brianlee-expensify commentedon Mar 10, 2026
@jponikarchuk based on @eVoloshchak's comment above about a new bug with the steps to reproduce, can you create a new GH ticket accordingly?
@mallenexpensify would love your thoughts on payment for this GH
jponikarchuk commentedon Mar 10, 2026
@brianlee-expensify Done #84772
mallenexpensify commentedon Mar 10, 2026
@eVoloshchak , can you report the bug in #expensify-open-source ? Post in the thread asking to be assigned and cc me plz.
Unsure on payment... pre-Melvin we had
I'm fine with that for now cuz @eVoloshchak invested time. My concern, going forward, is that we're setting precedence with Melv issues that, if they draft a PR paymente is due, even if the C+ only put in minimal time. Reckon we shoudl address that soon.
eVoloshchak commentedon Mar 11, 2026
This is being handled in #84772
brianlee-expensify commentedon Mar 11, 2026
Payment Summary
trjExpensify commentedon Mar 26, 2026
approved $125 for @eVoloshchak