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

[HOLD for payment 2023-05-22] [HOLD #14490] [$1000] Crash on IOURequestPage #16739

Closed
6 tasks done
roryabraham opened this issue Mar 30, 2023 · 29 comments
Closed
6 tasks done
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Engineering External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors Weekly KSv2

Comments

@roryabraham
Copy link
Contributor

roryabraham commented Mar 30, 2023

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. Go onto a slow network
  2. Login to New Expensify
  3. While the LHN is still loading and showing the skeleton UI, click on the global create menu
  4. Click on Send Money
  5. Enter an amount
  6. Press Enter

Expected Result:

You should be taken to the next screen to choose recipients. There should be a skeleton UI on that search page.

Actual Result:

The app crashes.

Workaround:

n/a

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

Issue reported by: n/a (@aimane-chnaif reported this in a PR review here when the bug was introduced and considered edgy/out-of-scope)
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1680147029222199

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~016871515dc2088e09
  • Upwork Job ID: 1643851935839272960
  • Last Price Increase: 2023-04-06
@roryabraham roryabraham added AutoAssignerTriage Auto assign issues for triage to an available triage team member Daily KSv2 labels Mar 30, 2023
@MelvinBot
Copy link

@roryabraham the AutoAssignerTriage label has been deprecated. Please use Bug for issue triage. See https://stackoverflowteams.com/c/expensify/questions/14418 for more details.

@melvin-bot melvin-bot bot removed the AutoAssignerTriage Auto assign issues for triage to an available triage team member label Mar 30, 2023
@roryabraham roryabraham added the Bug Something is broken. Auto assigns a BugZero manager. label Mar 30, 2023
@MelvinBot
Copy link

Triggered auto assignment to @lschurr (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@MelvinBot
Copy link

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@lschurr
Copy link
Contributor

lschurr commented Mar 30, 2023

Is this all platforms @roryabraham?

@aimane-chnaif
Copy link
Contributor

Is this all platforms @roryabraham?

yes all platforms.
You need to do actions quickly to go to IOURequestPage before loading personal details.
More high traffic and slower network, easier to reproduce.

@lschurr
Copy link
Contributor

lschurr commented Mar 31, 2023

I'm not able to reproduce, but maybe I just don't have a slow enough high traffic network to try. Adding Eng for more eyes.

@MelvinBot
Copy link

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

@melvin-bot melvin-bot bot added the Overdue label Apr 3, 2023
@MelvinBot
Copy link

@youssef-lr, @lschurr Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@lschurr
Copy link
Contributor

lschurr commented Apr 4, 2023

Hey @youssef-lr - any thoughts on this one?

@youssef-lr
Copy link
Contributor

I was able to reproduce this as well using Slow 3G in dev tools. Going to add External label to this one.

@youssef-lr youssef-lr added the External Added to denote the issue can be worked on by a contributor label Apr 6, 2023
@melvin-bot melvin-bot bot changed the title Crash on IOURequestPage [$1000] Crash on IOURequestPage Apr 6, 2023
@MelvinBot
Copy link

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

@MelvinBot
Copy link

Current assignee @lschurr is eligible for the External assigner, not assigning anyone new.

@MelvinBot
Copy link

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Apr 6, 2023
@MelvinBot
Copy link

Current assignee @youssef-lr is eligible for the External assigner, not assigning anyone new.

@bernhardoj
Copy link
Contributor

bernhardoj commented Apr 6, 2023

Proposal

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

IOU participants page crash when we open it while the app is still loading.

What is the root cause of that problem?

The error comes from here, specifically the Str.removeSMSDomain because the login is undefined.

let allPersonalDetailsOptions = _.map(personalDetails, personalDetail => createOption(
[personalDetail.login],
personalDetails,
reportMapForLogins[personalDetail.login],
reportActions,
{
showChatPreviewLine,
forcePolicyNamePreview,
},
));

_.chain(logins)
// Somehow it's possible for the logins coming from report.participants to contain undefined values so we use compact to remove them.
.compact()
.each((login) => {
let personalDetail = personalDetails[login];
if (!personalDetail) {
personalDetail = {
login,
displayName: Str.removeSMSDomain(login),
avatar: ReportUtils.getDefaultAvatar(login),
};
}

If we look at the code, it actually should be fine when we open the page while the app still loading (which means personalDetails is empty). But how can the loop still runs?

When we open the IOU page, it will call a OpenIOUModalPage API which will return a personal detail object with a local currency code which completes first before the OpenApp completes (which the personalDetails list comes from).
image

This makes we have a personalDetails list with a single item and only a localCurrencyCode property. That is why the loop runs and login is undefined.

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

We shouldn't call the OpenIOUModalPage API if we are still loading the initial data, by checking the _.isEmpty(personalDetails).

function openMoneyRequestModalPage() {
API.read('OpenIOUModalPage');
}

It is safe to not call it because we will get the localCurrencyCode from OpenApp too.

The Skeleton UI will be handled here #14490

@situchan
Copy link
Contributor

situchan commented Apr 6, 2023

Proposal

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

App crashes on IOURequest page when open immediately after login

What is the root cause of that problem?

When first enter MoneyRequestModal as soon as login success, OpenIOUModalPage api is called and pusher response is saved to Onyx before getting OpenApp api pusher response.
This case, personalDetails data changes from empty json {} to 1 array with {localCurrencyCode: 'USD"} which makes this loop called and finally crash happens on this line:

result.alternateText = Str.removeSMSDomain(personalDetail.login);

The crash is not constantly reproducible because of 2 reasons:

  • Sometimes OpenIOUModalPage pusher is later than OpenApp pusher. This case, personalDetails data is already complete.
  • When user open IOUParticipantsRequest page quickly, OpenIOUModalPage pusher event is not received yet and personalDetails is still empty {}.

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

refactor IOUParticipantsRequest, IOUParticipantsSplit pages.
current logic: OptionsListUtils.getNewChatOptions is always called in constructor
new logic:

  • call getNewChatOptions only when personalDetails has full current user info (I think login existence check is enough)
  • call getNewChatOptions both in constructor (when first enter page) and componentDidUpdate (to update list after reports or personalDetails data fully loaded)

NOTE: Even though OpenApp pusher data has localCurrencyCode, I don't recommend to remove OpenIOUModalPage api call because of following reasons:

  • refresh user currency when network becomes online from offline or every time when user visits IOURequest page
  • OpenIOUModalPage can be used for another purpose in the future, not only to get user currency

What alternative solutions did you explore? (Optional)

This issue can be on hold or closed because of following reasons:

@thesahindia
Copy link
Member

@youssef-lr, I think we should hold this because there is a possibility that it could be fixed in #14490.

@youssef-lr
Copy link
Contributor

@thesahindia thanks for linking that issue. Yeah I agree. I'm gonna go ahead and put this on hold.

@youssef-lr youssef-lr changed the title [$1000] Crash on IOURequestPage [HOLD #14490] [$1000] Crash on IOURequestPage Apr 7, 2023
@youssef-lr youssef-lr added Monthly KSv2 and removed Daily KSv2 labels Apr 7, 2023
@melvin-bot melvin-bot bot added the Reviewing Has a PR in review label Apr 21, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 11, 2023

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

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Monthly KSv2 labels May 15, 2023
@melvin-bot melvin-bot bot changed the title [HOLD #14490] [$1000] Crash on IOURequestPage [HOLD for payment 2023-05-22] [HOLD #14490] [$1000] Crash on IOURequestPage May 15, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label May 15, 2023
@melvin-bot
Copy link

melvin-bot bot commented May 15, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented May 15, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.13-5 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-05-22. 🎊

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

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

@melvin-bot
Copy link

melvin-bot bot commented May 15, 2023

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:

  • [@thesahindia] The PR that introduced the bug has been identified. Link to the PR:
  • [@thesahindia] 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:
  • [@thesahindia] A discussion in #expensify-bugs 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:
  • [@thesahindia] Determine if we should create a regression test for this bug.
  • [@thesahindia] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@lschurr] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@lschurr
Copy link
Contributor

lschurr commented May 16, 2023

This one was put on hold and fixed elsewhere, is that right @youssef-lr @thesahindia? Are there payments needed for this one?

@aimane-chnaif
Copy link
Contributor

This was fixed in #17349
I think I am only the one for reporting bonus

@lschurr
Copy link
Contributor

lschurr commented May 16, 2023

Great, could you apply to the job here @aimane-chnaif - https://www.upwork.com/jobs/~01dfce6726bdf40e71

@aimane-chnaif
Copy link
Contributor

@lschurr applied, thanks

@lschurr
Copy link
Contributor

lschurr commented May 16, 2023

Once payment is made, can we close this one @youssef-lr @thesahindia @aimane-chnaif?

@youssef-lr
Copy link
Contributor

Once payment is made, can we close this one @youssef-lr @thesahindia @aimane-chnaif?

Yup!

@lschurr
Copy link
Contributor

lschurr commented May 16, 2023

Great! Reporting bonus is paid. Closing this one.

@lschurr lschurr closed this as completed May 16, 2023
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. Engineering External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors Weekly KSv2
Projects
None yet
Development

No branches or pull requests

8 participants