Skip to content

[$175] When offline Grey text with "Upload Attachment" doesn't appear during uploading attachment #103326

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: v9.5.4-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://test-management.browserstack.com/projects/2219752/test-runs/76494298/folder/13176710/41236950/1815299163
Email or phone of affected tester (no customers): wimbukwa+1021026@applausemail.com
Issue reported by: Applause Internal Team
Bug source: Regression TC Execution
Device used: Samsung A34 / Android 16
App Component: Other

Action Performed:

Precondition: Logged into the Expensify App.

  1. Disable the internet connection on your phone.
  2. Open the Expensify App.
  3. Navigate to a chat and write something in the compose box.
  4. Add an attachment to a chat while there is text content in the composer.
  5. Verify that a comment appears with grey text "Uploading Attachment" indicating it is "pending".

Expected Result:

When offline, grey text with "Upload Attachment" should appear during uploading the attachment.

Actual Result:

When offline, grey text with "Upload Attachment" doesn't appear during uploading the attachment.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

screen-20261007-151427-1791375212837.mp4

View all open jobs on GitHub

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

Upwork Automation - Do Not Edit

Activity

  1. added
    Daily
    Bug
    on Oct 7, 2026
  2. MelvinBot commented on Oct 7, 2026

    @MelvinBot
    Contributor

    ⚠️ Preliminary analysis (low confidence) — treat as a starting point, not a conclusion.

    The test case may be out of date rather than the app being broken. The App no longer shows a literal "Uploading attachment" text for an offline attachment. Instead, the pending comment shows the composer text plus a local preview of the file, dimmed to 50% opacity while offline.

    • getUploadingAttachmentHtml builds the optimistic message as an <img>, <video>, or <a> tag that points at the local file URI. No translation string for "Uploading attachment" exists in src/.
    • When there is text and a file, addActions creates one combined ADD_TEXT_AND_ATTACHMENT action.
    • The grey look comes only from the OfflineWithFeedback opacity applied to pending actions. None of these files has an Android-only variant.

    One native change in this flow is possibly related: Skip preview modal for native platform when adding attachment, merged 2026-08-20. On iOS and Android, picking a file now sends it right away with the composer text (useAttachmentPicker.ts:50-57). It changes when the send happens, not the pending style, and it affects iOS too.

    I couldn't confirm this because I couldn't view the bug video, and I couldn't attach a file in the web test environment. To decide, check what the video shows after step 4:

    1. The comment appears dimmed, with the text and a file preview: the app works as designed. Update the test case so step 5 expects a dimmed comment with the text and attachment preview.
    2. No comment appears, or the text stays in the composer: look at the immediate native send from the PR above. Check whether clearComposer runs out of retries after the system picker returns, so onClear never submits the draft.
    3. The comment appears but isn't dimmed: check whether isOffline briefly flips to false when the app resumes from the system file picker.

    Next Steps: Reply with @MelvinBot <your feedback> to refine this analysis.

  3. added
    External
    on Oct 7, 2026
  4. melvin-bot commented on Oct 7, 2026

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @TaduJR (External)

  5. changed the title [-]When offline Grey text with "Upload Attachment" doesn't appear during uploading attachment[/-] [+][$175] When offline Grey text with "Upload Attachment" doesn't appear during uploading attachment[/+] on Oct 7, 2026
  6. melvin-bot commented on Oct 7, 2026

    @melvin-bot
  7. yuvrajangadsingh commented on Oct 10, 2026

    @yuvrajangadsingh
    Contributor

    withdrawing this, it went up before the issue had the Help Wanted label. will come back if the label is added.

  8. yuvrajangadsingh commented on Oct 10, 2026

    @yuvrajangadsingh
    Contributor

    withdrawn, see above.

  9. melvin-bot commented on Oct 12, 2026

    @melvin-bot

    @TaduJR Huh... This is 4 days overdue. Who can take care of this?

  10. jloa-dev commented on Oct 13, 2026

    @jloa-dev

    Proposal

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

    When the user goes offline and attaches a file to a chat that already contains text in the composer, on Android native the comment does not display the expected pending/greyed-out indicator or the optimistic action fails to appear.

    What is the root cause of that problem?

    There are two coupled root causes:

    1. Premature clearComposer Worklet Retries on Native Resume:
      In src/pages/inbox/report/ReportActionCompose/useAttachmentPicker.ts:50-56:

      if (isNative) {
          if (exceededMaxLength) {
              return;
          }
          addAttachment(files);
          return;
      }

      When the Android system document/image picker returns, the React Native Activity resumes. addAttachment immediately calls clearComposer() (src/pages/inbox/report/ReportActionCompose/ComposerProvider.tsx:124-149).
      At this exact instant, the composer ref or its clearWorklet has often not finished re-attaching. Because CONST.COMPOSER.CLEAR_WORKLET_MAX_RETRIES (3 retries via requestAnimationFrame) is exhausted in <50ms before the native input is ready, clearComposer logs:
      [ComposerProvider] Skipping clearComposer because composerRef.clearWorklet never re-attached
      and sets attachmentFileRef.current = null. As a result, validateAndSubmitDraft is never triggered and the optimistic comment is silently dropped.

    2. Optimistic Translation Key & Rendering in Combined Messages:
      In src/libs/ReportUtils.ts:7235-7265 (buildOptimisticAddCommentReportAction):

      const isAttachmentOnly = file && !text;
      const isAttachmentWithText = !!text && file !== undefined;
      // ...
      translationKey: isAttachmentOnly ? CONST.TRANSLATION_KEYS.ATTACHMENT : '',

      When text is present, translationKey is intentionally empty. The pending grey status in NewDot is driven by OfflineWithFeedback (pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD) applying opacity: 0.5. However, in ReportActionItemFragment.tsx:117-130, because isReportMessageAttachment returns false when text is present (hasOtherContent === true), it renders TextCommentFragment. In TextCommentFragment, if the optimistic image HTML tag has local file URI without an established cached thumbnail dimension while offline, the image container collapses or fails to show the pending dimmed container properly.

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

    1. Robust Native Worklet Re-attachment in ComposerProvider.tsx:
      Increase retry tolerance and handle post-system-picker re-attachment on native platforms so clearComposer does not discard attachmentFileRef:

      const maxRetries = isNative ? CONST.COMPOSER.CLEAR_WORKLET_NATIVE_MAX_RETRIES : CONST.COMPOSER.CLEAR_WORKLET_MAX_RETRIES;

      Or allow clearComposer to fallback to direct programmatic clearing and submit trigger if clearWorklet is unavailable.

    2. Ensure Optimistic Offline Attachment Container Renders Consistently:
      In src/libs/ReportUtils.ts, ensure getUploadingAttachmentHtml provides explicit initial fallback bounding styles for offline local URIs so RenderCommentHTML inside TextCommentFragment displays the dimmed local file preview and text with OfflineWithFeedback styling intact.

    3. Update Test Case Guidance:
      Clarify in Applause test documentation that NewDot replaces the legacy OldDot literal string "Uploading Attachment" with an optimistic dimmed card/message showing the text + attachment preview at 50% opacity.

    What alternative solutions did you explore? (Optional)

    What specific scenarios should we cover in automated tests?

    In tests/unit/ComposerProviderTest.tsx and tests/unit/ReportActionComposeTest.tsx:

    1. Simulate picking an attachment with pre-filled text while offline on Android, verifying that addAttachmentWithComment is called and attachmentFileRef is not dropped prematurely.
    2. Assert that the resulting optimistic reportAction contains both the text and the attachment with pendingAction: 'add' and is rendered with dimmed pending opacity.
  11. jloa-dev commented on Oct 13, 2026

    @jloa-dev

    Hi @TaduJR, following up on the proposal above. The analysis covers the root cause with native worklet re-attachment and optimistic rendering while offline. Let me know if you have any feedback or would like me to prepare the PR!

    Contributor details
    Your Expensify account email: jloa.dev@gmail.com
    Upwork Profile Link: https://www.upwork.com/freelancers/~0163955a2ba22190aa

  12. melvin-bot commented on Oct 13, 2026

    @melvin-bot

    ✅ Contributor details stored successfully. Thank you for contributing to Expensify!

  13. melvin-bot commented on Oct 14, 2026

    @melvin-bot

    @TaduJR 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

  14. melvin-bot commented on Oct 16, 2026

    @melvin-bot

    @TaduJR 8 days overdue is a lot. Should this be a Weekly issue? If so, feel free to change it!

  15. TaduJR commented on Oct 20, 2026

    @TaduJR
    Contributor

    Not overdue reviewing today

  16. melvin-bot commented on Oct 21, 2026

    @melvin-bot

    @TaduJR this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

  17. melvin-bot commented on Oct 23, 2026

    @melvin-bot

    @TaduJR Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  18. melvin-bot commented on Oct 27, 2026

    @melvin-bot

    @TaduJR 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

  19. melvin-bot commented on Oct 29, 2026

    @melvin-bot

    @TaduJR Now this issue is 8 days overdue. Are you sure this should be a Daily? Feel free to change it!

  20. TaduJR commented on Nov 2, 2026

    @TaduJR
    Contributor

    Not able to repro many times over. Please re-open if anything changed.

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

Metadata

Metadata

Assignees

Labels

BugDailyExternal

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions