Skip to content
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

[Due for payment 2025-02-28] [$250][Offline] Android - Workspace - Unresponsive confirm button and several WS created in offline mode #56696

Closed
2 of 8 tasks
IuliiaHerets opened this issue Feb 11, 2025 · 25 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@IuliiaHerets
Copy link

IuliiaHerets commented Feb 11, 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.0.96-0
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: Yes, repro on both
If this was caught during regression testing, add the test name, ID and link from TestRail: https://expensify.testrail.io/index.php?/tests/view/5583990&group_by=cases:section_id&group_order=asc&group_id=229067
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause Internal Team
Component Workspace Settings

Action Performed:

  1. Open the Expensify app.
  2. Tap on "Settings" and select "Workspaces"
  3. Turn off internet connection.
  4. Tap on "New Workspace"
  5. When navigated to editor, tap on "Default Currency" and select any different currency. (For example: USD)
  6. Tap on "Confirm" to create the workspace.
  7. If the "Confirm" button doesn´t trigger any action, tap on it a few more times until workspace is created.
  8. Return to inbox and check if the workspace was created and if it´s only displayed once.

Expected Result:

When creating a workspace while offline and changing default currency, the "Confirm" button should lead to the workspace creation on the first tap, and only one workspace should be created.

Actual Result:

When creating a workspace while offline and changing the default currency, the "Confirm" button has to be tapped several times until the workspace is created, and after this, several workspaces chats are displayed on LHN.
Opening those workspace chats, leads to error messages until only one workspace chat remains on LHN.

Workaround:

Unknown

Platforms:

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6739709_1739285350549.Confirm.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021889380867822286138
  • Upwork Job ID: 1889380867822286138
  • Last Price Increase: 2025-02-18
Issue OwnerCurrent Issue Owner: @mallenexpensify
@IuliiaHerets IuliiaHerets added Bug Something is broken. Auto assigns a BugZero manager. DeployBlockerCash This issue or pull request should block deployment labels Feb 11, 2025
Copy link

melvin-bot bot commented Feb 11, 2025

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

Copy link

melvin-bot bot commented Feb 11, 2025

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

Copy link

melvin-bot bot commented Feb 11, 2025

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

@melvin-bot melvin-bot bot added the Daily KSv2 label Feb 11, 2025
@github-actions github-actions bot added Engineering Hourly KSv2 and removed Daily KSv2 labels Feb 11, 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.

@IuliiaHerets
Copy link
Author

Not repro on prod

screen-20250211-192539.mp4

@yuwenmemon
Copy link
Contributor

This is pretty edge case so I'm not going to let it block the deploy and will switch it to External.

@yuwenmemon yuwenmemon 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 labels Feb 11, 2025
@melvin-bot melvin-bot bot changed the title Android - Workspace - Unresponsive confirm button and several WS created in offline mode [$250] Android - Workspace - Unresponsive confirm button and several WS created in offline mode Feb 11, 2025
Copy link

melvin-bot bot commented Feb 11, 2025

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

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

melvin-bot bot commented Feb 11, 2025

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

@mallenexpensify mallenexpensify changed the title [$250] Android - Workspace - Unresponsive confirm button and several WS created in offline mode [$250][Offline] Android - Workspace - Unresponsive confirm button and several WS created in offline mode Feb 12, 2025
@bernhardoj
Copy link
Contributor

Proposal

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

The submit button becomes unresponsive after coming back from the currency picker. This issue happens regardless of the network status.

What is the root cause of that problem?

When we submit the form, it will dismiss the keyboard first and wait until it finishes.

KeyboardUtils.dismiss().then(() => onSubmit(trimmedStringValues));

However, the keyboard is never dismissed even though we call Keyboard.dismiss already.

const subscription = Keyboard.addListener('keyboardDidHide', () => {
resolve(undefined);
subscription.remove();
});
Keyboard.dismiss();

If we look at how Keyboard.dismiss is implemented, it will blur the currently focused text input from TextInputState.currentlyFocusedInput(). If we log TextInput.State.currentlyFocusedInput() inside our keyboard util function, it will print null, so there is nothing to dismiss.

Why is it null?

The currentlyFocusedInput is set/cleared when an input is focused or blurred. When we open the workspace confirmation page, the workspace name input is focused, so currentlyFocusedInput now is the workspace name input. When we open the currency picker, the workspace name input isn't blurred. This happen on a new RN project too. I think this happens because Modal in Android is in a separate root view.

Then, the currency picker input is focused, which sets currentlyFocusedInput to the currency picker. When we close the currency picker, the currency picker input is blurred, so currentlyFocusedInput is set to null. Since the workspace name is never blurred, there is no focus event happening anymore, so the currentlyFocusedInput stays null. currentlyFocusedInput is only set again if we tap the input again.

Looking at the prod video, the keyboard doesn't show when coming back from the currency picker, which is why it's not reproducible.

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

We need to blur the input first before opening the modal. To do that, we can add shouldEnableNewFocusManagement to the modal. shouldEnableNewFocusManagement will blur the input and also refocuses it when the modal closes, which is the current behavior.

<Modal
type={CONST.MODAL.MODAL_TYPE.RIGHT_DOCKED}
isVisible={isPickerVisible}

If we don't want the refocus, then we can simply use Keyboard.dismiss when pressing the currency field item

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

N/A

@kaushiktd
Copy link
Contributor

kaushiktd commented Feb 13, 2025

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

Android - Workspace - Unresponsive confirm button and several WS created in offline mode

What is the root cause of that problem?

The problem stems from how React Native handles input focus when a modal is opened. Here’s what happens step-by-step:

  • When the workspace confirmation page opens, the workspace name input is automatically focused.
  • When the CurrencyPicker modal is triggered, the workspace input does not get blurred.
  • The CurrencyPicker input then gets focused, which updates TextInput.State.currentlyFocusedInput().
  • When closing the CurrencyPicker, its input gets blurred, and currentlyFocusedInput becomes null.
  • Since the workspace input was never blurred, React Native doesn't register a new focus event, and the input remains in an unfocused state.
  • The keyboard dismiss logic in FormProvider.tsx depends on currentlyFocusedInput, so when it’s null, the keyboard never dismisses properly. This causes the submit button to stop working.

This behavior is likely caused by how Android modals run in a separate root view, preventing proper focus transitions between inputs and modals.

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

To ensure correct focus handling, we need to blur the currently focused input before opening the modal.

  • Updated openPickerModal() to explicitly call Keyboard.dismiss() before opening the modal.
  • Introduced a small setTimeout() delay to ensure that the blur completes before the modal appears.
  • Enabled shouldEnableNewFocusManagement on the modal to automatically blur inputs when opening and refocus them when closing.

onPress={() => setIsPickerVisible(true)}

onPress={openPickerModal}

const openPickerModal = () => {
Keyboard.dismiss(); // Blur the input before opening the modal
setTimeout(() => setIsPickerVisible(true), 100); // Small delay to allow blur to complete
};

Why This Works?

  • Ensures that currentlyFocusedInput is always set correctly.
  • Prevents input focus from getting stuck in an undefined state.
  • Fixes the unresponsive submit button issue.

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

N/A

Video:-

screen-capture.webm

@mallenexpensify
Copy link
Contributor

@parasharrajat 👀 on proposals above plz

Copy link

melvin-bot bot commented Feb 18, 2025

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@melvin-bot melvin-bot bot added the Overdue label Feb 18, 2025
@parasharrajat
Copy link
Member

Looking at updated proposals.

@melvin-bot melvin-bot bot removed the Overdue label Feb 18, 2025
@parasharrajat
Copy link
Member

I think we can use the shouldEnableNewFocusManagement on the Modal thus @bernhardoj's proposal looks good to me.

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Feb 19, 2025

Current assignee @yuwenmemon is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Feb 19, 2025
@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Feb 20, 2025
@bernhardoj
Copy link
Contributor

PR is ready

cc: @parasharrajat

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Feb 21, 2025
@melvin-bot melvin-bot bot changed the title [$250][Offline] Android - Workspace - Unresponsive confirm button and several WS created in offline mode [Due for payment 2025-02-28] [$250][Offline] Android - Workspace - Unresponsive confirm button and several WS created in offline mode Feb 21, 2025
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Feb 21, 2025
Copy link

melvin-bot bot commented Feb 21, 2025

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

Copy link

melvin-bot bot commented Feb 21, 2025

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

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Feb 21, 2025

@parasharrajat @mallenexpensify @parasharrajat 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]

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Feb 28, 2025
Copy link

melvin-bot bot commented Feb 28, 2025

Payment Summary

Upwork Job

BugZero Checklist (@mallenexpensify)

  • I have verified the correct assignees and roles are listed above and updated the neccesary manual offers
  • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/1889380867822286138/hired)
  • I have paid out the Upwork contracts or cancelled the ones that are incorrect
  • I have verified the payment summary above is correct

@parasharrajat
Copy link
Member

BugZero Checklist:

  • [Contributor] Classify the bug:
Bug classification

Source of bug:

  • 1a. Result of the original design (eg. a case wasn't considered)
  • 1b. Mistake during implementation
  • 1c. Backend bug
  • 1z. Other:

Where bug was reported:

  • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
  • 2b. Reported on staging (eg. found during regression or PR testing)
  • 2d. Reported on a PR
  • 2z. Other:

Who reported the bug:

  • 3a. Expensify user
  • 3b. Expensify employee
  • 3c. Contributor
  • 3d. QA
  • 3z. Other:
  • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

    Link to comment: https://github.com/Expensify/App/pull/52392/files#r1975148736

  • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

    Link to discussion: Not needed

  • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

  • [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.

    Link to issue:

Regression Test Proposal

Test:

  1. Open Settings > Workspaces > New workspace
  2. Press the currency field
  3. Select any currency
  4. Press Save button
  5. Verify the WS is created

Do we agree 👍 or 👎

@bernhardoj
Copy link
Contributor

Requested in ND.

@mallenexpensify
Copy link
Contributor

Contributor: @bernhardoj due $250 via NewDot
Contributor+: @parasharrajat due $250 via NewDot

Test case below, thx y'all!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering External Added to denote the issue can be worked on by a contributor
Projects
Status: Done
Development

No branches or pull requests

6 participants