Skip to content

[HOLD for payment 2023-09-08] Web - App Crashes when reloading after editing the Merchant #26181

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!


Action Performed:

  1. Request money from user A
  2. Go the report
  3. Click on the Merchant to edit
  4. Clear the field and click on Save
    Notice 'removed the merchant (previously "Request")' message appears
  5. Refresh the page

Expected Result:

The app does not crash

Actual Result:

App crashes

Workaround:

Unknown

Platforms:

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

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.58.0
Reproducible in staging?: y
Reproducible in production?: n
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation

T131.Appchrash-1.mp4
Recording.4065.mp4

Expensify/Expensify Issue URL:
Issue reported by: @daveSeife
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1693277798912359

View all open jobs on GitHub

Activity

  1. OSBotify commented on Aug 29, 2023

    @OSBotify
    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.
  2. melvin-bot commented on Aug 29, 2023

    @melvin-bot

    Triggered auto assignment to @MariaHCD (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

  3. mountiny commented on Aug 29, 2023

    @mountiny
    Contributor

    Merchant cannot be empty thats backend restriction, we probably need to add a validation here

  4. Pujan92 commented on Aug 29, 2023

    @Pujan92
    Contributor

    Proposal

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

    Not validating the merchant field to be required(not reproducing crash on the dev env)

    What is the root cause of that problem?

    We don't have any validation to restrict empty value for the merchant.

    Reason for a crash: When we refresh the money request report we receive incorrect structure by ReconnectApi call for reportActions which leads to the transaction undefined and accessing fields of undefined crashes the app.

    <OfflineWithFeedback pendingAction={lodashGet(transaction, 'pendingFields.amount') || lodashGet(transaction, 'pendingAction')}>

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

    Add validate function and pass it to the the Form by setting the merchant as a required field.

    <TextInput
    inputID="merchant"
    name="merchant"

    <TextInput
    inputID="moneyRequestMerchant"
    name="moneyRequestMerchant"

    const validate = (values) => {
            const requiredFields = ['merchant'];
            const errors = ValidationUtils.getFieldRequiredErrors(values, requiredFields);
            return errors;
        }
    

    Same needs to be done for MoneyRequestMerchantPage component by using the field name moneyRequestMerchant.

    Provide the default value in the lodashGet pendingFields.fieldname for pendingAction prop which we are passing to OfflineWithFeedback in the MoneyRequestView component. 1, 2, 3, 4

  5. MariaHCD commented on Aug 29, 2023

    @MariaHCD
    Contributor

    cc: @koko57 Please let us know what you find, thanks!

  6. melvin-bot commented on Aug 29, 2023

    @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.

  7. koko57 commented on Aug 29, 2023

    @koko57
    Contributor

    @MariaHCD I couldn't reproduce it locally, I managed to reproduce it on staging so it's hard for me to tell for now what the exact RC is. I think that if we don't want to change the merchant to the empty string, the solution @Pujan92 proposes should work here

  8. Pujan92 commented on Aug 29, 2023

    @Pujan92
    Contributor

    I am able to reproduce the crash locally also due to incorrect orders bcoz whenever we refresh the money request report we won't get pendingFields in the api onyx response which causes the issue(accessing undefined of pendingFields).

  9. MariaHCD commented on Aug 29, 2023

    @MariaHCD
    Contributor

    That makes sense, thanks @Pujan92.

    One thing about your proposal:

    Reason for a crash might be: Conditions are in the wrong order for all the fields here. First, we need to check for pendingAction availability in the transaction and then check for specific child fields.

    Do you mean we first need to check for pendingFields in the transaction before trying to fetch any child fields?

  10. Pujan92 commented on Aug 29, 2023

    @Pujan92
    Contributor

    Yes @MariaHCD

    Sorry, I made a mistake in thinking. We need to provide a default value for specific pendingFields considering the above reason bcoz we need to greyed out in any condition. I will update my proposal.

    - {lodashGet(transaction, 'pendingFields.amount') || lodashGet(transaction, 'pendingAction')}
    + {lodashGet(transaction, 'pendingFields.amount', null) || lodashGet(transaction, 'pendingAction')}
  11. MariaHCD commented on Aug 29, 2023

    @MariaHCD
    Contributor

    Okay, I was finally able to reproduce the issue on staging and saw the console error:

    Screenshot 2023-08-29 at 5 13 51 PM

    Screen.Recording.2023-08-29.at.5.13.25.PM.mov
  12. 38 remaining items

  13. mountiny commented on Aug 31, 2023

    @mountiny
    Contributor

    Created a PR which will not allow empty merchants

  14. trjExpensify commented on Aug 31, 2023

    @trjExpensify
    Contributor

    Cool, so confirming after that PR is merged we'll pay the reporting bonus of $250 for this issue only?

  15. mountiny commented on Aug 31, 2023

    @mountiny
    Contributor

    @trjExpensify I think we can already pay out the reporting bonus $250, the crash is fixed now

  16. trjExpensify commented on Sep 1, 2023

    @trjExpensify
    Contributor

    Okay, perfect. @daveSeife I've sent you an offer.

  17. daveSeife commented on Sep 1, 2023

    @daveSeife

    @trjExpensify Accepted the offer. Thank You!

  18. trjExpensify commented on Sep 1, 2023

    @trjExpensify
    Contributor

    Perfect, paid!

  19. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed on Sep 1, 2023
  20. changed the title [-]Web - App Crashes when reloading after editing the Merchant[/-] [+][HOLD for payment 2023-09-08] Web - App Crashes when reloading after editing the Merchant[/+] on Sep 1, 2023
  21. melvin-bot commented on Sep 1, 2023

    @melvin-bot

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

  22. melvin-bot commented on Sep 1, 2023

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.61-3 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 2023-09-08. 🎊

    After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

    • External issue reporter
    • Contributor that fixed the issue
    • Contributor+ that helped on the issue and/or PR

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

    As a reminder, here are the bonuses/penalties that should be applied for any External issue:

    • Merged PR within 3 business days of assignment - 50% bonus
    • Merged PR more than 9 business days after assignment - 50% penalty
  23. melvin-bot commented on Sep 1, 2023

    @melvin-bot

    BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

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

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.EngineeringWeeklyKSv2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions