Skip to content

Odometer - Photo is not cropped after saving cropped photo #85365

Closed

Description

@mitarachim

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.3.38-0
Reproducible in staging?: Yes
Reproducible in production?: N/A - new feature, doesn't exist in prod
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #83556
Email or phone of affected tester (no customers): applausetester+sjddjois2j1d@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.
  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Click + > Track distance > Odometer.
  4. Enter Start and End reading.
  5. Insert Start and End photo.
  6. Click Next.
  7. On confirm page, click Distance.
  8. Click Start or End photo.
  9. Click Crop.
  10. Crop the photo and click Save.

Expected Result:

Cropped area will be saved.

Actual Result:

Photo is not cropped after saving cropped photo.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari

Screenshots/Videos

Bug7104088_1773658002293.8.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    DeployBlockerIndicates it should block deploying the API
    on Mar 16, 2026
  2. melvin-bot commented on Mar 16, 2026

    @melvin-bot

    You have been assigned to this deploy blocker because you recently merged this PR: #83556

  3. melvin-bot commented on Mar 16, 2026

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  4. github-actions commented on Mar 16, 2026

    @github-actions
    Contributor

    👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  5. OSBotify commented on Mar 16, 2026

    @OSBotify
    Contributor

    🔍 Investigation Summary

    Classification: Frontend bug
    Causing PR: #83556 - "[Odometer] Image stitching" by @jakubkalinski0 (High confidence)
    Related Issues: None

    Recommendation: REVERT

    PR #83556 introduced image stitching for odometer photos but did not implement proper crop handling for individual odometer images. The crop functionality updates the main transaction receipt instead of the individual odometer image, causing the cropped changes to be lost.

    Labels: No label changes made. Both DeployBlockerCash and DeployBlocker labels were added by an Expensify org member, so per the investigation guidelines, I am not removing them. An internal engineer should review whether the DeployBlocker label is appropriate for this frontend-only issue.

    📋 Detailed Analysis

    Evidence

    PR #83556 introduced the odometer image stitching feature which combines start and end odometer photos into a single receipt image. The PR modified:

    • Added src/libs/stitchOdometerImages/ library for combining images
    • Modified IOURequestStepDistanceOdometer.tsx to call stitching and set the combined image as the receipt
    • Modified TransactionReceiptModalContent.tsx to handle display of stitched receipts

    The bug is reproducible on staging (v9.3.38-0) where this PR was merged, and does not exist in production where this feature does not exist.

    Verification

    The issue occurs in the crop flow within TransactionReceiptModalContent.tsx. When a user:

    1. Creates an odometer distance request with both start and end photos
    2. Proceeds to the confirmation page (images are stitched at this point)
    3. Goes back to edit an individual photo (Start or End)
    4. Crops the photo and clicks Save

    Root Cause Location: /home/runner/_work/App/App/src/pages/media/AttachmentModalScreen/routes/TransactionReceiptModalContent.tsx lines 332-391

    The saveCrop function does not have any special handling for odometer images:

    const saveCrop = useCallback(() => {
        // ... cropping logic ...
        if (isDraftTransaction) {
            setMoneyRequestReceipt(transaction.transactionID, imageUriResult, croppedFilename, isDraftTransaction, receiptType);
        } else {
            replaceReceipt({...});
        }
    }, [transaction?.transactionID, isDraftTransaction, sourceUri, isImage, cropRect, receiptFilename, policyCategories, transaction?.receipt?.type, policy, exitCropMode]);

    Root Cause

    When cropping an individual odometer photo (Start or End), the code calls setMoneyRequestReceipt() which updates the main transaction receipt, not the individual odometer image (odometerStartImage or odometerEndImage).

    The correct behavior should be:

    1. Call setMoneyRequestOdometerImage() to update the individual odometer image
    2. Re-trigger the stitching logic to regenerate the combined receipt with the newly cropped image

    Since the individual odometer images are not updated, the crop changes are lost. The main receipt gets temporarily replaced with just the cropped individual photo, but this is incorrect as it should be a stitched combination of both images.

  6. DylanDylann commented on Mar 16, 2026

    @DylanDylann
    Contributor
  7. MelvinBot commented on Mar 16, 2026

    @MelvinBot
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    When viewing an individual odometer photo (start or end) from the confirmation page and using the Crop tool, the crop does not persist — the photo reverts to its original uncropped state after saving.

    What is the root cause of that problem?

    PR #83556 introduced odometer image stitching. Individual odometer photos are stored in transaction.comment.odometerStartImage / transaction.comment.odometerEndImage, which is a different storage location than regular receipts (transaction.receipt.source).

    The saveCrop function in TransactionReceiptModalContent.tsx (line 332-391) correctly crops the displayed odometer image, but then saves the result by calling setMoneyRequestReceipt(), which writes to transaction.receipt.source. It never updates the actual individual odometer image stored in transaction.comment. The correct function setMoneyRequestOdometerImage() (defined at src/libs/actions/IOU/index.ts:1662-1681) exists but is never called from saveCrop.

    So the crop result is written to the wrong storage location, and the next time the odometer image is displayed, it reads from the unchanged transaction.comment.odometerStartImage/odometerEndImage — showing the original uncropped photo. The same issue applies to rotateReceipt (line 259-305).

    What changes do you think we should make in order to solve the problem?

    In TransactionReceiptModalContent.tsx:

    1. saveCrop: When isOdometerImage is true, call setMoneyRequestOdometerImage(transactionID, imageType, croppedFileObject, isDraftTransaction) instead of setMoneyRequestReceipt(). After updating the individual image, trigger re-stitching of the two images so transaction.receipt.source (the combined receipt) also reflects the crop.

    2. rotateReceipt: Apply the same odometer-aware logic — when isOdometerImage is true, save the rotated result via setMoneyRequestOdometerImage() and re-stitch.

    What alternative solutions did you explore? (Optional)

    An alternative would be to hide the Crop/Rotate buttons entirely for individual odometer images (similar to how they're already hidden for the stitched receipt via isStitchedOdometerReceipt). However, this removes useful functionality rather than fixing it, and the bug report clearly shows users expect to be able to crop these photos.


    Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.

  8. 38 remaining items

  9. melvin-bot commented on Mar 23, 2026

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  10. melvin-bot commented on Mar 23, 2026

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.41-4 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2026-03-30. 🎊

    For reference, here are some details about the assignees on this issue:

  11. melvin-bot commented on Mar 23, 2026

    @melvin-bot

    @situchan / @DylanDylann The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

  12. melvin-bot commented on Mar 23, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  13. Julesssss commented on Mar 23, 2026

    @Julesssss
    Contributor

    Fix on production. Payment handled for @DylanDylann here #83945.

  14. changed the title [-][Due for payment 2026-03-30] [$250] Odometer - Photo is not cropped after saving cropped photo[/-] [+]Odometer - Photo is not cropped after saving cropped photo[/+] on Mar 23, 2026
  15. Julesssss commented on Apr 6, 2026

    @Julesssss
    Contributor

    Fix on production. Payment handled for @DylanDylann here #83945.

    Reopening for @situchan payment ONLY.

  16. mallenexpensify commented on Apr 7, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor+: @situchan due $250 via NewDot

  17. laurenreidexpensify commented on Apr 16, 2026

    @laurenreidexpensify
    Contributor

    Payment Approved - $250 in New Expensify @situchan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.EngineeringWeeklyKSv2

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions