Skip to content

[Due for payment 2026-02-26] Android - Attachment - Blank preview on the 4th attachment preview #82723

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.21-0
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #82282
Email or phone of affected tester (no customers): josidnjnsdjsodjosjni@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Samsung Galaxy S25 FE / Android
App Component: Money Requests

Action Performed:

  1. Launch Expensify app.
  2. Go to workspace chat.
  3. Tap + > Add attachment > Choose from gallery.
  4. Select 4 photos.
  5. On the preview, swipe to the 4th attachment.

Expected Result:

App will preview the 4th attachment.

Actual Result:

4th attachment preview is blank.
This issue happens with 4th attachment onward.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7080938_1771374565812.Screen_Recording_20260218_081600_Expensify.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @RachCHopkins

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    DeployBlockerIndicates it should block deploying the API
    on Feb 18, 2026
  2. melvin-bot commented on Feb 18, 2026

    @melvin-bot

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

  3. melvin-bot commented on Feb 18, 2026

    @melvin-bot

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

  4. melvin-bot commented on Feb 18, 2026

    @melvin-bot

    Triggered auto assignment to @RachCHopkins (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.

  5. github-actions commented on Feb 18, 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.
  6. MelvinBot commented on Feb 18, 2026

    @MelvinBot
    Contributor

    Proposal

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

    On Android, when selecting 4 or more photos to attach to a message (via + > Add attachment > Choose from gallery), the 4th attachment preview and beyond are blank. Swiping to the 4th photo in the preview carousel shows nothing.

    What is the root cause of that problem?

    There are two interacting bugs:

    Primary cause: convertFileToAttachment() in AddAttachmentModalCarouselView.tsx:9-18 does not set attachmentID on the Attachment objects it creates from selected files. It only sets file and source.

    This causes every Lightbox instance in the carousel to resolve to page = 0 via findIndex at Lightbox/index.tsx:104:

    const foundPage = state.pagerItems.findIndex((item) => item.attachmentID === attachmentID);
    

    Since both the Lightbox's attachmentID prop and each pagerItem's attachmentID are undefined, findIndex always returns 0 (the first match where undefined === undefined).

    How this causes the blank screen: Every Lightbox thinks it is page 0. When the user swipes to page 3, activePage in the context becomes 3. For every Lightbox:

    • isActive = (page === activePage) = (0 === 3) = false
    • isLightboxVisible = |0 - 3| = 3 > indexCanvasOffset(0) = false (on Android, NUMBER_OF_CONCURRENT_LIGHTBOXES = 1)
    • isFallbackInRange = |0 - 3| = 3 > FALLBACK_OFFSET(2) = false

    The useEffect at line 238 fires because !isActive && !isLightboxVisible is true, and sets isFallbackVisible = isFallbackInRange = false.

    Result: For the Lightbox actually displayed at position 3, neither the lightbox image (guarded by isLightboxVisible) nor the fallback image (guarded by isFallbackVisible && isFallbackInRange) renders. The user sees a blank screen.

    This was exposed by PR #82282 which introduced the FALLBACK_OFFSET = 2 limit. Before that PR, isFallbackInRange didn't exist and the fallback was always visible regardless of page position, masking the incorrect page values.

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

    In convertFileToAttachment() in AddAttachmentModalCarouselView.tsx, generate a unique attachmentID for each file-based attachment. This can use the file's uri as the attachmentID (or generate a unique ID), so that each Lightbox correctly identifies which page it corresponds to in the pager context:

    return {
        file,
        source: file.uri ?? '',
        attachmentID: file.uri ?? '',
    };
    

    This ensures findIndex at Lightbox/index.tsx:104 returns the correct page index for each Lightbox, fixing all the downstream calculations (isActive, isLightboxVisible, isFallbackInRange).

    What alternative solutions did you explore? (Optional)

    1. Increasing FALLBACK_OFFSET: This would only push the breakpoint further (e.g., blank at 6th attachment instead of 4th) without fixing the root cause.
    2. Reverting PR Limit fallback image rendering and add priority to reduce carousel lo… #82282: This would fix the immediate symptom but re-introduce the bandwidth starvation issue that PR was solving.
    3. Modifying Lightbox to fall back to index-based page lookup when attachmentID is undefined: This is more defensive but doesn't fix the underlying data quality issue. Other code that depends on attachmentID could also be affected.

    Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, or @MelvinBot <your feedback> to refine this analysis.

  7. 3 remaining items

  8. mountiny commented on Feb 18, 2026

    @mountiny
    Contributor

    Waiting for a retest

  9. m-natarajan commented on Feb 18, 2026

    @m-natarajan

    The issue is no longer reproducible on Android 16, Samsung A15. Build 9.3.21-4-staging

    Android_82723.mp4
  10. added and removed
    DeployBlockerCashThis issue or pull request should block deployment
    on Feb 18, 2026
  11. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed on Feb 19, 2026
  12. changed the title [-]Android - Attachment - Blank preview on the 4th attachment preview[/-] [+][Due for payment 2026-02-26] Android - Attachment - Blank preview on the 4th attachment preview[/+] on Feb 19, 2026
  13. melvin-bot commented on Feb 19, 2026

    @melvin-bot

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

  14. melvin-bot commented on Feb 19, 2026

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.3.22-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-02-26. 🎊

  15. melvin-bot commented on Feb 19, 2026

    @melvin-bot

    @cristipaval @RachCHopkins 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]

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