Skip to content

feat: render high-res PDF overlay on receipt hover zoom #93627

Open

Description

@mountiny

Problem

PDF receipts are served as low-resolution JPG thumbnails by the server. When users hover to zoom on web, the magnification is applied to an upscaled raster image, making PDF text appear blurry instead of sharp.

Solution

Added ReceiptPDFOverlay, a web-only component that renders the actual PDF at 2.5× its on-screen size (via CSS scale) so hover-zoom reveals real PDF pixels. A native no-op stub keeps bundling clean. Extracted HOVER_ZOOM_SCALE to CONST.RECEIPT for shared use, and integrated the overlay into ReportActionItemImage with graceful fallback to the JPG thumbnail when the PDF fails to load.

PR

#93583

Activity

  1. added
    ReviewingHas a PR in review
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jun 15, 2026
  2. MelvinBot commented on Jun 15, 2026

    @MelvinBot
    Contributor

    Issue Analysis

    This is a feature already implemented in Expensify/App#93583. The core approach is sound, but the PR bundles a non-obvious behavior change to distance-receipt handling that should be confirmed as intentional.

    How the fix works (sound): The JPG thumbnail stays as the instant preview. On web with hover support, ReceiptPDFOverlay mounts the real PDF on top via PDFPreviewer, rendered at HOVER_ZOOM_SCALE (2.5×) its box size and CSS-scaled back down by 1/2.5 so it visually matches the thumbnail. When ReceiptHoverZoom magnifies the whole layer by the same 2.5× on hover, the PDF reaches its native render resolution → sharp text. On PDF load failure it renders null, revealing the JPG underneath. Native is a no-op stub. This composition is correct and the shared CONST.RECEIPT.HOVER_ZOOM_SCALE keeps the two scales in lockstep.

    ⚠️ Main risk — distance-receipt behavior change (verify intent): The PR replaces the inline isDistanceRequest && !isManualDistanceRequest in MoneyRequestReceiptView with a new shared isMapBasedDistanceRequest, but the two are not equivalent. This drives canShowReceiptActions, so the change affects which distance receipts show action buttons — beyond the stated PDF-zoom scope.

    Transaction Old isMapDistanceRequest New isMapBasedDistanceRequest
    Odometer true (actions hidden) false (actions now shown)
    Plain distance w/o waypoints true false
    distance-manual w/ waypoints false true (the documented intent)

    The distance-manual-with-waypoints case is the intended fix, but the odometer and waypoint-less rows are side effects that flip receipt-action visibility. Worth a deliberate check.

    Evidence & investigation details
    • Old inline logic: MoneyRequestReceiptView.tsx — removed const isMapDistanceRequest = !!transaction && isDistanceRequest && !isManualDistanceRequest(transaction), now isMapBasedDistanceRequest(transaction).
    • New predicate: TransactionUtils/index.ts:187-193 — false for odometer; otherwise isMap || isGPS || hasWaypoints.
    • Consumer: canShowReceiptActions = hasReceipt && !isLoading && isEditable && !isMapDistanceRequest && !mergeTransactionID.
    • Overlay composition: ReceiptPDFOverlay/index.tsx (oversample 250% + scale(1/2.5)), wrapped by ReceiptHoverZoom/useReceiptHoverZoom.ts which applies transform: scale(scale) on pointermove.
    • Overlay gating: ReportActionItemImage.tsx — isRemotePDF = isPDF && !isLocalFile && !isEReceipt && !isMapBasedDistanceRequest && !!pdfSourceURL, then && canZoomReceipt && hasHoverSupport(). canZoomReceipt is only passed from MoneyRequestReceiptView (single-receipt detail view), so only one PDF is ever overlaid at a time.

    Minor (low priority): The PDFPreviewer mounts and renders eagerly at 2.5× as soon as the detail view opens, not on first hover. For the single-receipt detail view this is fine, but it is upfront work behind an interaction that may never happen — mounting on first hover would avoid it if PDF render cost becomes a concern.

    Alternative explanations considered: Could the blur be fixed by serving a higher-res thumbnail server-side instead? Yes, but that is a backend change outside App; the client-side overlay is a reasonable App-only fix.


    Next Steps: Reply with @MelvinBot <feedback> to refine this analysis. The approach in #93583 looks good to ship once the isMapBasedDistanceRequest behavior change above is confirmed intentional (or scoped to only the distance-manual-with-waypoints case).

  3. changed the title [-]feat: render high-res PDF overlay on receipt hover zoom[/-] [+][Due for payment 2026-06-25] feat: render high-res PDF overlay on receipt hover zoom[/+] on Jun 18, 2026
  4. melvin-bot commented on Jun 18, 2026

    @melvin-bot

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

  5. melvin-bot commented on Jun 18, 2026

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.14-1 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-06-25. 🎊

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

  6. melvin-bot commented on Jun 18, 2026

    @melvin-bot

    @ZhenjaHorbach 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]. If no checklist is needed for this issue, you can click: [no checklist button]

  7. melvin-bot commented on Jun 18, 2026

    @melvin-bot

    @ZhenjaHorbach Whoops! This issue is 2 days overdue. Let's get this updated quick!

  8. 13 remaining items

  9. melvin-bot commented on Jun 29, 2026

    @melvin-bot

    @mountiny @WojtekBoman @ZhenjaHorbach this issue was created 2 weeks ago. Are we close to a solution? Let's make sure we're treating this as a top priority. Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

  10. WojtekBoman commented on Jun 30, 2026

    @WojtekBoman
    Contributor

    I created a draft PR for this: #94560. Once I've polished it, I'll send it to review :)

  11. melvin-bot commented on Jul 27, 2026

    @melvin-bot

    This issue has not been updated in over 15 days. @mountiny, @WojtekBoman, @ZhenjaHorbach eroding to Monthly issue.

    P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

  12. ZhenjaHorbach commented on Jul 28, 2026

    @ZhenjaHorbach
    Contributor

    We have one issue that we decided to fix in a separate PR

  13. melvin-bot commented on Sep 23, 2026

    @melvin-bot

    @mountiny, @WojtekBoman, @ZhenjaHorbach, this Monthly task hasn't been acted upon in 6 weeks; closing.

    If you disagree, feel encouraged to reopen it -- but pick your least important issue to close instead.

  14. ZhenjaHorbach commented on Sep 24, 2026

    @ZhenjaHorbach
    Contributor

    @MelvinBot
    Reopen this issue

  15. MelvinBot commented on Sep 24, 2026

    @MelvinBot
    Contributor

    🤖 Reopened.

    ZhenjaHorbach — this was auto-closed as a stale Monthly task. It's open again. Both feat: render high-res PDF overlay on receipt hover zoom and [Payment due @ZhenjaHorbach] fix(ReceiptImage): render local PDF receipts via LocalPDFReceiptPreview are merged, so the remaining follow-up you flagged still needs its own PR.


    view run

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.MonthlyKSv2Not a priorityReviewingHas a PR in review

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions