App icon indicating copy to clipboard operation
App copied to clipboard

[Due for payment 2026-11-14] [$175] [Exploratory] Native share - Image is duplicated in chat when tapping the Share button several times

Open applause-bot[bot] opened this issue 5 months ago • 32 comments

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: v9.4.12-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/60976966/folder/13176721/41236967/1496566574?sort=%2Bidentifier Email or phone of affected tester (no customers): n/a Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: iPhone 13 iOS 26.5 App Component: Chat Report View

Action Performed:

  1. Open the app
  2. On the device media library - Choose a picture or receipt to share through the "Expensify" app
  3. Choose the option as "Share"
  4. Select any contact or workspace
  5. Tap the Share button several times

Expected Result:

Only one image should be shared in the chat regardless of how many times the Share button is tapped.

Actual Result:

Image is duplicated in chat when tapping the Share button several times

Workaround:

Unknown

Platforms:

  • [ ] Android: App
  • [ ] Android: mWeb Chrome
  • [x] iOS: App
  • [ ] iOS: mWeb Safari
  • [ ] iOS: mWeb Chrome
  • [ ] Windows: Chrome
  • [ ] MacOS: Chrome Safari

Screenshots/Videos

https://github.com/user-attachments/assets/91099f77-9294-44fb-add5-cc7264ede5c2

View all open jobs on GitHub

Applause Internal Information Exported by: Mita Rachim Bug ID: 7184173

Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @Eskalifer1

applause-bot[bot] avatar Jun 18 '26 12:06 applause-bot[bot]

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

applause-bot[bot] avatar Jun 18 '26 12:06 applause-bot[bot]

@applause-bot[bot], 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.

melvin-bot[bot] avatar Aug 31 '26 22:08 melvin-bot[bot]

This issue is reproducible in the latest staging v9.5.3-0 for the QA team

https://github.com/user-attachments/assets/69aa03b7-6296-4812-ad21-319ca758187b

unzig21 avatar Oct 06 '26 09:10 unzig21

Proposal

What is the root cause of that problem?

The Share page has no guard against repeat taps.

ShareButton passes only onPress to Button. It never sets isLoading or isDisabled. handleShare only checks that an attachment exists. It does not check whether a share is already running.

For files, handleShare calls readFileAsync. That function reads the file asynchronously, then calls addAttachmentWithComment and navigates away. The button stays active during the read and the modal dismissal. Each tap in that window starts another read, and each read posts the image again.

The generic useSingleExecution lock in the pressable does not help. handleShare returns void, so the lock releases about one tick after the tap, before the file read finishes.

Code references

The text-share path has the same gap, because navigation happens on a later animation frame.

The sibling Submit flow already guards this. SubmitDetailsPage.tsx:609-613 uses a formHasBeenSubmitted ref and resets it on read failure at line 633.

No guard was ever removed. ShareDetailsPage has never had one. This is not a regression from a specific PR.

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

Use the same pattern as SubmitDetailsPage:

  1. In ShareDetailsPage, add an isSharingRef ref and an isSharing state.
  2. At the top of handleShare, return early if isSharingRef.current is true. Otherwise set the ref and the state to true. This covers both the text and file paths.
  3. In the readFileAsync failure callback, reset the ref and the state so the user can retry.
  4. Add an isLoading prop to ShareButton, pass it to Button, and pass isSharing from ShareDetailsPage.

What alternative solutions did you explore? (Optional)

Return the readFileAsync Promise from handleShare so useSingleExecution holds the lock. This is weaker: the lock releases when onSuccess returns, before the navigation and dismiss animation finish, so late taps could still post again.


Next Steps for Contributor+ team: To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/93931) to create a draft PR. To refine: @MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.


view run

MelvinBot avatar Oct 06 '26 09:10 MelvinBot

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

melvin-bot[bot] avatar Oct 06 '26 09:10 melvin-bot[bot]

Job added to Upwork: https://www.upwork.com/jobs/~022107409114710136681

melvin-bot[bot] avatar Oct 06 '26 09:10 melvin-bot[bot]

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

melvin-bot[bot] avatar Oct 09 '26 21:10 melvin-bot[bot]

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

yuvrajangadsingh avatar Oct 09 '26 22:10 yuvrajangadsingh

@ChavdaSachin Still overdue 6 days?! Let's take care of this!

melvin-bot[bot] avatar Oct 13 '26 21:10 melvin-bot[bot]

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

melvin-bot[bot] avatar Oct 15 '26 21:10 melvin-bot[bot]

@ChavdaSachin 12 days overdue now... This issue's end is nigh!

melvin-bot[bot] avatar Oct 19 '26 21:10 melvin-bot[bot]

This issue has not been updated in over 14 days. @ChavdaSachin eroding to Weekly issue.

melvin-bot[bot] avatar Oct 22 '26 21:10 melvin-bot[bot]

I can help as C+ here!

Eskalifer1 avatar Oct 30 '26 16:10 Eskalifer1

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

melvin-bot[bot] avatar Nov 03 '26 09:11 melvin-bot[bot]

📣 @Eskalifer1 You have been assigned to this job! Please apply to the Upwork job and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻 Once you apply to this job, your Upwork ID will be stored and you will be automatically hired for future jobs! Keep in mind: Code of Conduct | Contributing 📖

melvin-bot[bot] avatar Nov 03 '26 21:11 melvin-bot[bot]

@MelvinBot implement this

Eskalifer1 avatar Nov 03 '26 21:11 Eskalifer1

⏱️ Ran out of time before I could finish. This usually means the task was too complex or I got stuck exploring. Please try again with a more specific request or post in #melvinbot-ai.

Run details

MelvinBot avatar Nov 03 '26 21:11 MelvinBot

@MelvinBot implement this

Eskalifer1 avatar Nov 03 '26 21:11 Eskalifer1

🤖 Web test steps verification results: ⚠️ partial

Verified the app opens on dev NewDot web. Native sharing steps and text-sharing/retry remain unverified because the required entry point is unavailable.

Web actions menu without the native Share entry point
Step Status
1. Open appAuthenticated Home screen rendered.
✅
2. Choose a picture/receipt from the device media libraryNative media-library sharing is unavailable on web.
⚠️
3. Choose ShareThe web actions menu has no native Share entry.
Web actions menu without the native Share entry point
⚠️
4. Select a contact/workspaceThe destination selector requires native shared content.
⚠️
5. Tap Share repeatedly; verify one imageThe native confirmation screen could not be reached.
⚠️
Text sharing and failure/retryNo accessible web entry point was available.
⚠️
Source-only inspectionThe share handler guards repeated taps, shows loading, and unlocks after read failure. This is not runtime verification.
✅

Draft PR created: Prevent duplicate native shares from repeated Share taps, assigned to Eskalifer1. Three regression tests, lint, typecheck, component compiler checks, and Storybook smoke passed. Full-suite and check-script limits are documented in the PR. Complete native iOS verification before marking it ready for review.


view run · no recording available

MelvinBot avatar Nov 03 '26 22:11 MelvinBot

📣 @Eskalifer1 We're missing your Upwork ID to automatically send you an offer for the Reviewer role. Once you apply to the Upwork job, your Upwork ID will be stored and you will be automatically hired for future jobs!

melvin-bot[bot] avatar Nov 04 '26 10:11 melvin-bot[bot]