Skip to content

[$250] Android - Profile - Gallery only opens after tapping Choose from gallery twice #61951

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 of 8 tasks
mitarachim opened this issue May 13, 2025 · 17 comments
Open
1 of 8 tasks
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Engineering External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2

Comments

@mitarachim
Copy link

mitarachim commented May 13, 2025

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: 9.1.45-0
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught during regression testing, add the test name, ID and link from TestRail: Exp
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause Internal Team
Device used: Samsung Galaxy Z Fold 4 / Android 14
App Component: Other

Action Performed:

  1. Launch Expensify app.
  2. Go to Account.
  3. Tap Profile.
  4. Tap on the avatar.
  5. Tap Choose from gallery.
  6. Tap on the avatar.
  7. Tap Choose from gallery.

Expected Result:

In Step 5, device gallery will open.

Actual Result:

In Step 5, device gallery does not open.
In Step 7, after repeating the steps, device gallery opens.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug6830132_1747165301795.Screen_Recording_20250514_034017_Photos___videos.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021922536195053093945
  • Upwork Job ID: 1922536195053093945
  • Last Price Increase: 2025-05-14
  • Automatic offers:
    • linhvovan29546 | Contributor | 107302757
Issue OwnerCurrent Issue Owner: @allroundexperts
@mitarachim mitarachim added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels May 13, 2025
Copy link

melvin-bot bot commented May 13, 2025

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

@mitarachim mitarachim added DeployBlockerCash This issue or pull request should block deployment DeployBlocker Indicates it should block deploying the API labels May 14, 2025
@github-actions github-actions bot added Engineering Hourly KSv2 and removed Daily KSv2 labels May 14, 2025
Copy link
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.

Copy link

melvin-bot bot commented May 14, 2025

Triggered auto assignment to @robertjchen (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

Copy link

melvin-bot bot commented May 14, 2025

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

@linhvovan29546
Copy link
Contributor

linhvovan29546 commented May 14, 2025

Proposal

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

Android - Profile - Gallery only opens after tapping Choose from gallery twice

What is the root cause of that problem?

Regression from #61165 where we migrated to using a new modal for the Popover. In the AttachmentPicker, we have logic that opens the picker/attachment after the modal is hidden. However, the function is not being called as expected when the modal hides (first time).

onModalHide.current = () => {

Why is that?

We passed the ref function directly like this:

onModalHide={onModalHide.current}

Since onModalHide.current is a reference to a function, it undefined during the first execution.

In BottomDockedModal, we invoke onModalHide inside onCloseCallback(on Android), which is called using runOnJS. During the first modal close, onModalHide is called with an undefined value due to the way refs work and how runOnJS executes. As a result, the gallery does not show the first time. On the second attempt, the modal re-renders and the ref is defined, so it works.

if (getPlatform() !== CONST.PLATFORM.IOS) {
onModalHide();
}

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

To ensure a stable function reference that always reflects the current value, we should wrap the call like this:

                onModalHide={()=> onModalHide.current?.()}

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

N/A

What alternative solutions did you explore? (Optional)

Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

@linhvovan29546
Copy link
Contributor

@robertjchen Happy to raise a PR if this is urgent and my solution works

@robertjchen robertjchen added Daily KSv2 External Added to denote the issue can be worked on by a contributor and removed DeployBlockerCash This issue or pull request should block deployment Hourly KSv2 DeployBlocker Indicates it should block deploying the API labels May 14, 2025
@melvin-bot melvin-bot bot changed the title Android - Profile - Gallery only opens after tapping Choose from gallery twice [$250] Android - Profile - Gallery only opens after tapping Choose from gallery twice May 14, 2025
Copy link

melvin-bot bot commented May 14, 2025

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label May 14, 2025
Copy link

melvin-bot bot commented May 14, 2025

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

@jmusial
Copy link
Contributor

jmusial commented May 14, 2025

Hey, I'm the author of #61165. @linhvovan29546 s solution LGTM.

Copy link

melvin-bot bot commented May 14, 2025

⚠️ 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.

@trjExpensify
Copy link
Contributor

@robertjchen did you remove this as a deploy blocker on purpose? It's still unchecked on the deploy checklist.

@linhvovan29546 does your proposal fix this issue and this one: #61927?

@linhvovan29546
Copy link
Contributor

@trjExpensify Yes, I've tested and resolved that as well

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label May 14, 2025
Copy link

melvin-bot bot commented May 14, 2025

📣 @linhvovan29546 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app!

Offer link
Upwork job
Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
Keep in mind: Code of Conduct | Contributing 📖

@mountiny
Copy link
Contributor

@linhvovan29546 can you please raise the pr

@linhvovan29546
Copy link
Contributor

Sure!

@linhvovan29546
Copy link
Contributor

the PR is ready ^

@robertjchen
Copy link
Contributor

@trjExpensify Apologies for the confusion there- will make sure to check that moving forward 👀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Engineering External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2
Projects
Status: No status
Development

No branches or pull requests

9 participants