You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[$175] When offline Grey text with "Upload Attachment" doesn't appear during uploading attachment #103326
⚠️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.
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:
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.
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.
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.
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
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:
Premature clearComposer Worklet Retries on Native Resume:
In src/pages/inbox/report/ReportActionCompose/useAttachmentPicker.ts:50-56:
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.
Optimistic Translation Key & Rendering in Combined Messages:
In src/libs/ReportUtils.ts:7235-7265 (buildOptimisticAddCommentReportAction):
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?
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:
Or allow clearComposer to fallback to direct programmatic clearing and submit trigger if clearWorklet is unavailable.
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.
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:
Simulate picking an attachment with pre-filled text while offline on Android, verifying that addAttachmentWithComment is called and attachmentFileRef is not dropped prematurely.
Assert that the resulting optimistic reportAction contains both the text and the attachment with pendingAction: 'add' and is rendered with dimmed pending opacity.
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!
@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!
Activity
applause-bot commentedon Oct 7, 2026
While Applause doesn't embed attachments for this bug, here are the links for quick view:
https://platform.applause.com/services/links/v1/external/a3f266063163e54e6ab9395ec8e271d9dfbe8d7084572eb6fe32cb80a98e36f3
https://platform.applause.com/services/links/v1/external/e5edc6af58aa44fdcf2e3993f3100172310446e22963695503a6c43417746968
MelvinBot commentedon Oct 7, 2026
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.
getUploadingAttachmentHtmlbuilds the optimistic message as an<img>,<video>, or<a>tag that points at the local file URI. No translation string for "Uploading attachment" exists insrc/.addActionscreates one combinedADD_TEXT_AND_ATTACHMENTaction.OfflineWithFeedbackopacity 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:
clearComposerruns out of retries after the system picker returns, soonClearnever submits the draft.isOfflinebriefly flips tofalsewhen the app resumes from the system file picker.Next Steps: Reply with
@MelvinBot <your feedback>to refine this analysis.melvin-bot commentedon Oct 7, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @TaduJR (
External)[-]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[/+]melvin-bot commentedon Oct 7, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022107813804128160468
yuvrajangadsingh commentedon Oct 10, 2026
withdrawing this, it went up before the issue had the
Help Wantedlabel. will come back if the label is added.yuvrajangadsingh commentedon Oct 10, 2026
withdrawn, see above.
melvin-bot commentedon Oct 12, 2026
@TaduJR Huh... This is 4 days overdue. Who can take care of this?
jloa-dev commentedon Oct 13, 2026
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:
Premature
clearComposerWorklet Retries on Native Resume:In
src/pages/inbox/report/ReportActionCompose/useAttachmentPicker.ts:50-56:When the Android system document/image picker returns, the React Native Activity resumes.
addAttachmentimmediately callsclearComposer()(src/pages/inbox/report/ReportActionCompose/ComposerProvider.tsx:124-149).At this exact instant, the composer ref or its
clearWorklethas often not finished re-attaching. BecauseCONST.COMPOSER.CLEAR_WORKLET_MAX_RETRIES(3 retries viarequestAnimationFrame) is exhausted in <50ms before the native input is ready,clearComposerlogs:[ComposerProvider] Skipping clearComposer because composerRef.clearWorklet never re-attachedand sets
attachmentFileRef.current = null. As a result,validateAndSubmitDraftis never triggered and the optimistic comment is silently dropped.Optimistic Translation Key & Rendering in Combined Messages:
In
src/libs/ReportUtils.ts:7235-7265(buildOptimisticAddCommentReportAction):When text is present,
translationKeyis intentionally empty. The pending grey status in NewDot is driven byOfflineWithFeedback(pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD) applyingopacity: 0.5. However, inReportActionItemFragment.tsx:117-130, becauseisReportMessageAttachmentreturnsfalsewhen text is present (hasOtherContent === true), it rendersTextCommentFragment. InTextCommentFragment, 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?
Robust Native Worklet Re-attachment in
ComposerProvider.tsx:Increase retry tolerance and handle post-system-picker re-attachment on native platforms so
clearComposerdoes not discardattachmentFileRef:Or allow
clearComposerto fallback to direct programmatic clearing and submit trigger ifclearWorkletis unavailable.Ensure Optimistic Offline Attachment Container Renders Consistently:
In
src/libs/ReportUtils.ts, ensuregetUploadingAttachmentHtmlprovides explicit initial fallback bounding styles for offline local URIs soRenderCommentHTMLinsideTextCommentFragmentdisplays the dimmed local file preview and text withOfflineWithFeedbackstyling intact.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.tsxandtests/unit/ReportActionComposeTest.tsx:addAttachmentWithCommentis called andattachmentFileRefis not dropped prematurely.reportActioncontains both the text and the attachment withpendingAction: 'add'and is rendered with dimmed pending opacity.jloa-dev commentedon Oct 13, 2026
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
melvin-bot commentedon Oct 13, 2026
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
melvin-bot commentedon Oct 14, 2026
@TaduJR 6 days overdue. This is scarier than being forced to listen to Vogon poetry!
melvin-bot commentedon Oct 16, 2026
@TaduJR 8 days overdue is a lot. Should this be a Weekly issue? If so, feel free to change it!
TaduJR commentedon Oct 20, 2026
Not overdue reviewing today
melvin-bot commentedon Oct 21, 2026
@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!
melvin-bot commentedon Oct 23, 2026
@TaduJR Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
melvin-bot commentedon Oct 27, 2026
@TaduJR 6 days overdue. This is scarier than being forced to listen to Vogon poetry!
melvin-bot commentedon Oct 29, 2026
@TaduJR Now this issue is 8 days overdue. Are you sure this should be a Daily? Feel free to change it!
TaduJR commentedon Nov 2, 2026
Not able to repro many times over. Please re-open if anything changed.