Skip to content

[Due for payment 2026-08-21] Spend - Receipt takes time to load after switching between tabs #98559

Closed

Description

@applause-bot

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number: 9.4.53-1
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #98305
Email or phone of affected tester (no customers): soidnjsdjoijojdsiojdos@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.5 / Chrome
App Component: Search

Action Performed:

  1. Go to staging.new.expensify.com
  2. Create an expense with receipt in workspace chat.
  3. Go to Spend > Expenses.
  4. Go to Reports.
  5. Go to Expenses.

Expected Result:

Receipt will load quickly after switching tab.

Actual Result:

Receipt takes time to load after switching between tabs.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7232392_1786604568756.13.mp4

View all open jobs on GitHub

Applause Internal Information
Exported by: Julia Ponikarchuk
Bug ID: 7232392

Issue OwnerCurrent Issue Owner: @bernhardoj

Activity

  1. applause-bot commented on Aug 13, 2026

    @applause-bot
    Author

    While Applause doesn't embed attachments for this bug, here are the links for quick view:
    https://platform.applause.com/services/links/v1/external/928045a76b466162ba3d5c53389fd55a95e8a5206d2de88592f0c729101ad35f

  2. added
    DeployBlockerCash
    Bug
    on Aug 13, 2026
  3. melvin-bot commented on Aug 13, 2026

    @melvin-bot

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

  4. melvin-bot commented on Aug 13, 2026

    @melvin-bot

    @mountiny @QichenZhu you have been assigned to this deploy blocker because you reviewed the offending PR: #98305

  5. melvin-bot commented on Aug 13, 2026

    @melvin-bot

    @BartekObudzinski you have been assigned to this deploy blocker because you authored the offending PR: #98305

  6. melvin-bot commented on Aug 13, 2026

    @melvin-bot

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

  7. github-actions commented on Aug 13, 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.
  8. MelvinBot commented on Aug 13, 2026

    @MelvinBot
    Contributor

    🔍 Investigation Summary

    Classification: Frontend bug
    Causing PR: #97313 - "Defer image loading and use original receipt image" by @bernhardoj (High confidence)
    Related Issues: The auto-assigned PR #98305 is not the cause (see below).

    Recommendation: REVERT

    PR #97313 deliberately defers receipt image loading until a screen's navigation transition ends, which is exactly what produces the reported "receipt takes time to load after switching between tabs" delay in the Search Expenses/Reports views. Reverting is clean (5 self-contained files, one new component); a roll-forward is possible if @bernhardoj can quickly scope the deferral to exclude the Search transaction list.

    Assigned: @bernhardoj (PR author), @mountiny, @joekaufmanexpensify, @thesahindia (approving reviewers) from PR #97313.
    Labels: No change. Kept DeployBlockerCash (this is a frontend/App bug that blocks the App deploy). No DeployBlocker label was present to remove.

    📋 Detailed Analysis

    Why the auto-assigned PR #98305 is NOT the cause

    PR #98305 ("stop Search re-firing an identical query on unrelated Onyx updates") only modifies src/hooks/useSearchHighlightAndScroll.ts and its test. That hook decides whether Search re-fetches its query when Onyx transactions/report actions change — it does not touch image loading, thumbnails, or image caching. If anything it reduces network calls. It cannot cause a receipt image to render slowly on tab switch. Melvin auto-assigned it only because @BartekObudzinski merged it recently.

    Evidence

    • The bug is staging-only (not production), so the cause is a PR in the current StagingDeployCash release. PR Defer image loading and use original receipt image #97313 is in that checklist, merged 2026-08-11, on staging but not yet production.
    • Commit cc95429 in PR Defer image loading and use original receipt image #97313 is literally titled "defer image loading until navigation transition ended" — a one-to-one match with the symptom "receipt takes time to load after switching between tabs."
    • The new DeferredImageWithLoading component gates the real image behind didScreenTransitionEnd: during a screen entry transition it renders an empty same-size placeholder and only mounts the image once the transition finishes. Switching Search tabs (Expenses → Reports → Expenses) is a screen transition, so the receipt thumbnail is held back until the transition completes, producing the perceptible delay.

    Verification

    • Affected UI: receipt thumbnails in the Search Expenses list.
    • Render path confirmed in the checked-out App tree: TransactionItemRow/TransactionItemRow{Wide,Narrow}.tsx → DataCells/ReceiptCell.tsx → @components/ReceiptImage → DeferredImageWithLoading.
    • PR Defer image loading and use original receipt image #97313 changes src/components/ReceiptImage/index.tsx to render DeferredImageWithLoading instead of ImageWithLoading, and routes ImageWithSizeCalculation through it too — so every receipt cell in Search now inherits the deferral.
    • Files changed by Defer image loading and use original receipt image #97313: DeferredImageWithLoading.tsx (new), ImageWithLoading.tsx, ImageWithSizeCalculation.tsx, ReceiptImage/index.tsx, ReportActionItem/ReportActionItemImage.tsx.

    Root Cause

    The intended optimization (keep image fetch/decode/layout out of the navigation animation for smoother transitions) has the side effect that any receipt shown in a list which re-mounts on a screen transition — such as the Search Expenses/Reports tabs — cannot begin loading its image until didScreenTransitionEnd becomes true. The result is the placeholder-then-delayed-image behavior QA observed. The gate is a deliberate design choice in the PR, so this is a genuine App-side regression, not a backend issue.

    Key code:

    • Gate logic:
      function DeferredImageWithLoading({containerStyles, onLayout, ...rest}: ImageWithSizeLoadingProps) {
      const styles = useThemeStyles();
      // Read the context directly rather than through `useScreenWrapperTransitionStatus`, which throws outside a
      // ScreenWrapper. There is no screen entry transition to wait for in that case, so don't hold the image back.
      const screenWrapperStatus = useContext(ScreenWrapperStatusContext);
      const didScreenTransitionEnd = screenWrapperStatus?.didScreenTransitionEnd ?? true;
      // Also wait out any transition still tracked once the screen has settled, e.g. an overlapping modal or keyboard one.
      const shouldRenderImage = useRunAfterTransitions(didScreenTransitionEnd);
      if (!shouldRenderImage) {
      return (
      <View
      style={[styles.w100, styles.h100, containerStyles]}
      onLayout={onLayout}
      />
      );
      }
      return (
      <ImageWithLoading
      containerStyles={containerStyles}
      onLayout={onLayout}
      {...rest}
    • Receipt path switched to the deferred wrapper:
      }
      return (
      <DeferredImageWithLoading
      onLayout={(e) => {
      if (e.nativeEvent.layout.width !== receiptImageWidth && e.timeStamp - lastUpdateWidthTimestampRef.current > MIN_UPDATE_WIDTH_DIFF) {
      setReceiptImageWidth(e.nativeEvent.layout.width);
      }
    • Search receipt cell:
      >
      <ReceiptImage
      source={source}
      isEReceipt={isEReceipt}
      transactionID={transactionItem.transactionID}
      shouldUseThumbnailImage
      thumbnailContainerStyles={styles.bgTransparent}
      isAuthTokenRequired
      fallbackIcon={icons.Receipt}
      fallbackIconSize={20}
      fallbackIconColor={theme.icon}
      fallbackIconBackground={isSelected ? theme.buttonHoveredBG : undefined}
      iconSize="x-small"
      loadingIconSize="small"
      loadingIndicatorStyles={styles.receiptCellLoadingContainer}
      transactionItem={transactionItem}
      shouldUseInitialObjectPosition
      isPerDiemRequest={isPerDiem}
      />
      {shouldMountPreview && (
  9. 11 remaining items

  10. bernhardoj commented on Aug 13, 2026

    @bernhardoj
    Contributor

    Checking

  11. bernhardoj commented on Aug 13, 2026

    @bernhardoj
    Contributor

    Ah, this is because we defer the image until the transition is done. I think we should conditionally defer it. Will open a PR.

  12. added
    Reviewing
    Weekly
    and removed
    Daily
    on Aug 13, 2026
  13. bernhardoj commented on Aug 13, 2026

    @bernhardoj
    Contributor

    Opened the PR.

  14. melvin-bot commented on Aug 13, 2026

    @melvin-bot

    ⚠️ Looks like this issue was linked to a Deploy Blocker here

    If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

    If a regression has occurred and you are the assigned CM follow the instructions here.

    If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

  15. m-natarajan commented on Aug 13, 2026

    @m-natarajan

    Passed, Chrome / v9.4.53-4, Xiaomi Redmi Note 10 / Android 12

    REC-20260813181044.mp4
    Screenrecorder-2026-08-13-18-26-02-320.1.mp4
  16. added
    Daily
    and removed
    Reviewing
    Weekly
    on Aug 14, 2026
  17. changed the title [-]Spend - Receipt takes time to load after switching between tabs[/-] [+][Due for payment 2026-08-21] Spend - Receipt takes time to load after switching between tabs[/+] on Aug 14, 2026
  18. melvin-bot commented on Aug 14, 2026

    @melvin-bot

    @bernhardoj / @thesahindia

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.4.53-10 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-08-21. 🎊

    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]

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

Metadata

Metadata

Labels

BugDailyEngineering

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions