Skip to content

[$500] Expense - Unable to save Merchant by hitting Enter in confirmation page #37294

Closed

Description

@kbecciv

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: v1.4.44-0
Reproducible in staging?: y
Reproducible in production?: n
Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to staging.new.expensify.com.
  2. Go to FAB > Request money > Manual.
  3. Enter amount and select participant.
  4. Proceed to confirmation page.
  5. Click Show more > Merchant.
  6. Enter a merchant and hit Enter.

Expected Result:

The Merchant will be saved when hitting Enter.

Actual Result:

The Merchant is not saved when hitting Enter.
This issue also occurs with Description.

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6393850_1709032184834.20240227_133522.1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0173bf7e04af9fbaa2
  • Upwork Job ID: 1762479426479763456
  • Last Price Increase: 2024-02-27

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    ExternalAdded to denote the issue can be worked on by a contributor
    on Feb 27, 2024
  2. changed the title [-]Expense - Unable to save Merchant by hitting Enter in confirmation page[/-] [+][$500] Expense - Unable to save Merchant by hitting Enter in confirmation page[/+] on Feb 27, 2024
  3. melvin-bot commented on Feb 27, 2024

    @melvin-bot
  4. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Feb 27, 2024
  5. melvin-bot commented on Feb 27, 2024

    @melvin-bot

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

  6. github-actions commented on Feb 27, 2024

    @github-actions
    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.
  7. melvin-bot commented on Feb 27, 2024

    @melvin-bot

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

  8. kbecciv commented on Feb 27, 2024

    @kbecciv
    Author

    We think that this bug might be related to #wave5-free-submitters
    CC @dylanexpensify

  9. 2 remaining items

  10. Pujan92 commented on Feb 27, 2024

    @Pujan92
    Contributor

    Please link the offended PR as it is not reproducible on production.

  11. added and removed
    DeployBlockerCashThis issue or pull request should block deployment
    on Feb 27, 2024
  12. grgia commented on Feb 27, 2024

    @grgia
    Contributor

    I don't think this needs to block deploy

  13. Pujan92 commented on Feb 27, 2024

    @Pujan92
    Contributor

    It is from #31606 where BaseOptionsSelector enter callback triggered, same is happening for the description step form too. cc: @Piotrfj

  14. BhuvaneshPatil commented on Feb 27, 2024

    @BhuvaneshPatil
    Contributor

    Proposal

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

    Expense - Unable to save Merchant by hitting Enter in confirmation page

    What is the root cause of that problem?

    The pr is - #31606
    The root cause of problem is we have subscribed to enter shortcut on BaseOptionsSelector, that prevents the form from submitting, and that avoid bubbling of that event.

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

    We shall unsubscribe to Enter shortcut key event.
    When we go to different pages (ex - Description, Merchant)
    To Do this, we need to make following changes -

    1. For use effect here -
      useEffect(() => {
      // Unregister the shortcut before registering a new one to avoid lingering shortcut listener
      enterSubscription.current();
      if (!disableEnterShortCut) {
      subscribeToEnterShortcut();
      }
      // eslint-disable-next-line react-hooks/exhaustive-deps
      }, [disableEnterShortCut]);

      we shall also check if isFocused (not from prop) is true. This means we are only subscribing if we are on the page that has BaseOptionsSelector, not the inside. Because then it will act as we press enter it's on the confirmation list.
    Changes
    useEffect(() => {
        // Unregister the shortcut before registering a new one to avoid lingering shortcut listener
        enterSubscription.current();
        if (!disableEnterShortCut && isFocused) {
            subscribeToEnterShortcut();
        }
        // eslint-disable-next-line react-hooks/exhaustive-deps
    }, [disableEnterShortCut]);
    2. While subscribing to events, we shall also check if the window is focused (the value we using `useIsFocused()`) for this use effect

    useEffect(() => {
    if (props.isFocused) {
    subscribeToEnterShortcut();
    subscribeToCtrlEnterShortcut();
    } else {
    unSubscribeFromKeyboardShortcut();
    }
    // eslint-disable-next-line react-hooks/exhaustive-deps
    }, [props.isFocused]);

    Changes
    useEffect(() => {
        if (isFocused) {
            subscribeToEnterShortcut();
            subscribeToCtrlEnterShortcut();
        } else {
            unSubscribeFromKeyboardShortcut();
        }
        // eslint-disable-next-line react-hooks/exhaustive-deps
    }, [isFocused]);
    1. We need to remove the subscriptions done by the hooks cause they kind of pollute the events (spent alot of time in this )
      useKeyboardShortcut(CONST.KEYBOARD_SHORTCUTS.ENTER, selectFocusedOption, {
      shouldBubble: !allOptions[focusedIndex],
      captureOnInputs: true,
      });
      useKeyboardShortcut(CONST.KEYBOARD_SHORTCUTS.CTRL_ENTER, selectOptions, {captureOnInputs: true});

    result -

    Screen.Recording.2024-02-28.at.2.32.24.AM.mov

    What alternative solutions did you explore? (Optional)

  15. melvin-bot commented on Feb 28, 2024

    @melvin-bot

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

  16. Piotrfj commented on Feb 29, 2024

    @Piotrfj
    Contributor

    Update: re-refactoring is ready to be tested, it fixes all the regression issues I was aware of. Please test it (especially the tags, because I could not yet replicate the scenario on my site).
    The fix is based on the @roryabraham solution, so special thanks for him!
    Link to PR: #37494

  17. melvin-bot commented on Mar 4, 2024

    @melvin-bot

    @Pujan92, @grgia Eep! 4 days overdue now. Issues have feelings too...

  18. grgia commented on Mar 4, 2024

    @grgia
    Contributor

    I take it we can close this one out @Pujan92 ?

  19. situchan commented on Mar 4, 2024

    @situchan
    Contributor

    Offending PR was reverted - #31606 (comment)
    Fine to close

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

Metadata

Metadata

Assignees

Labels

DailyKSv2EngineeringExternalAdded to denote the issue can be worked on by a contributorHelp WantedApply this label when an issue is open to proposals by contributors

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions