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

[$1000] Money request page crash after sign in #23420

Closed
6 tasks done
kavimuru opened this issue Jul 23, 2023 · 47 comments
Closed
6 tasks done

[$1000] Money request page crash after sign in #23420

kavimuru opened this issue Jul 23, 2023 · 47 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2

Comments

@kavimuru
Copy link

kavimuru commented Jul 23, 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. Sign out if you are signed in
  2. Go to staging.new.expensify.com/request/new
  3. Login

Expected Result:

App crash

Actual Result:

App should not crash

Workaround:

Can the user still use Expensify without this being fixed? Have you informed them of the workaround?

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.44-0
Reproducible in staging?: y
Reproducible in production?: y
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

Screen.Recording.2023-07-22.at.17.04.45.mov
Recording.1320.mp4

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

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01c96f9a061c08188b
  • Upwork Job ID: 1683620832387874816
  • 2023-07-24
  • Automatic offers:
    • bernhardoj | Contributor | 25856547
    • bernhardoj | Reporter | 25856549
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 23, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 23, 2023

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

@kavimuru
Copy link
Author

Proposal

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

The app crash when opening the money request page after signing in

What is the root cause of that problem?

The crash happens because in TextInputWithCurrencySymbol, selectedCurrencyCode prop is marked as required, but it got undefined.

/** Currency code of user's selected currency */
selectedCurrencyCode: PropTypes.string.isRequired,

The selectedCurrencyCode is passed down from MoneyRequestAmountPage with the value from props.iou.currency (Onyx IOU). We have a defaultProps that set the currency to USD.
iou: {
id: '',
amount: 0,
currency: CONST.CURRENCY.USD,
participants: [],
},

defaultProps will be used if iou is undefined. The problem is, Onyx IOU itself has a default value.

App/src/setup/index.js

Lines 31 to 39 in b7d17e0

initialKeyStates: {
// Clear any loading and error messages so they do not appear on app startup
[ONYXKEYS.SESSION]: {loading: false},
[ONYXKEYS.ACCOUNT]: CONST.DEFAULT_ACCOUNT_DATA,
[ONYXKEYS.NETWORK]: {isOffline: false},
[ONYXKEYS.IOU]: {
loading: false,
error: false,
},

So, when we sign in, we have an IOU object of {loading, error} which will ignore the defaultProps in MoneyRequestAmountPage, thus the currency is undefined.
This issue is a regression of my PR here #17964. Previously, we use lodashGet to get the currency and default to USD. Here is the commit of using the lodashGet https://github.com/Expensify/App/pull/17964/commits/4fdf587c1fca3cc147f7184c1bf765bcd2cf5ee5#diff-879f243892ee617d3ea9b[…]91d2bec3eb12b90f09aac6a05a
but somehow I remove it in a later commit.

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

I think that's okay to not use lodashGet and instead we can remove the default value of Onyx IOU.
(remove this)

App/src/setup/index.js

Lines 36 to 39 in b7d17e0

[ONYXKEYS.IOU]: {
loading: false,
error: false,
},

Both loading and error are not being used anywhere.

What alternative solutions did you explore? (Optional)

Make selectedCurrencyCode in TextInputWithCurrencySymbol optional and set USD as the default prop of selectedCurrencyCode.

@melvin-bot
Copy link

melvin-bot bot commented Jul 23, 2023

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

@JmillsExpensify
Copy link

Screenshot 2023-07-24 at 17 28 56

Interestingly, I don't get a crash for this case though I do see this.

@JmillsExpensify
Copy link

In any case, I think that's largely a detail given that it's consistent with your video. I'm going to triage as a result.

@JmillsExpensify JmillsExpensify added the External Added to denote the issue can be worked on by a contributor label Jul 24, 2023
@melvin-bot melvin-bot bot changed the title Money request page crash after sign in [$1000] Money request page crash after sign in Jul 24, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jul 24, 2023

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

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

melvin-bot bot commented Jul 24, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Jul 24, 2023

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

@MuhammadASif011
Copy link

Hello, If you need my help to fix this task, so please let me know. Thank you
[$1000] Money request page crash after sign in #23420 - Expensify

Upwork profile: https://www.upwork.com/freelancers/~01ef98c02265da3b6f

@melvin-bot
Copy link

melvin-bot bot commented Jul 25, 2023

📣 @MuhammadASif011! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  2. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  3. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@kayowakmelese
Copy link

Hello, we can solve the issue by modifying this code
//Check if props.iou.currency exists, otherwise, use the default currency (USD)
const selectedCurrencyCode = props.iou.currency || 'USD';

@melvin-bot
Copy link

melvin-bot bot commented Jul 25, 2023

📣 @kayowakmelese! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  2. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  3. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@kayowakmelese
Copy link

Contributor details
Your Expensify account email: kayomelese4@gmail.com
Upwork Profile Link: https://www.upwork.com/fl/~01393ae9100dff9b33

@melvin-bot
Copy link

melvin-bot bot commented Jul 25, 2023

⚠️ Missing/invalid email or upwork profile link. Please make sure you add both your Expensify email and Upwork profile link in the format specified.

@kayowakmelese
Copy link

Contributor details
Your Expensify account email: kayomelese4@gmail.com
Upwork Profile Link: https://www.upwork.com/fl/~01393ae9100dff9b33

@melvin-bot
Copy link

melvin-bot bot commented Jul 25, 2023

⚠️ Missing/invalid email or upwork profile link. Please make sure you add both your Expensify email and Upwork profile link in the format specified.

@kayowakmelese
Copy link

Contributor details
Your Expensify account email: kayomelese4@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~01393ae9100dff9b33

@melvin-bot
Copy link

melvin-bot bot commented Jul 25, 2023

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

@MuhammadASif011
Copy link

Contributor details
Expensify account email: asifsuperior43@gmail.com
Upwork Profile Link: https://www.upwork.com/freelancers/~01ef98c02265da3b6f

@flyingmorrow
Copy link

It is snap to fix it I think.
In this case error occurred due to variable of currency.
check currency variable and prevent case that can not be undefined then it can be fixed easily I think.
I can fix it rapidly.
Please kindly send me mail to handsome.sladar@gmail.com
then I can fix it right now.
Thank you.

@melvin-bot
Copy link

melvin-bot bot commented Jul 25, 2023

📣 @flyingmorrow! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:

  1. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  2. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  3. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
    Screen Shot 2022-11-16 at 4 42 54 PM
    Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

@allroundexperts
Copy link
Contributor

allroundexperts commented Jul 25, 2023

The RCA and solution mentioned in @bernhardoj's proposal looks good to me.

🎀 👀 🎀 C+ reviewed

@melvin-bot
Copy link

melvin-bot bot commented Jul 31, 2023

📣 @allroundexperts Please request via NewDot manual requests for the Reviewer role ($1000)

@melvin-bot
Copy link

melvin-bot bot commented Jul 31, 2023

📣 @bernhardoj 🎉 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 📖

@melvin-bot
Copy link

melvin-bot bot commented Jul 31, 2023

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

Offer link
Upwork job

@bernhardoj
Copy link
Contributor

Can't log in to the app. I think there is a log in problem.

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Jul 31, 2023
@bernhardoj
Copy link
Contributor

PR is ready for review

cc: @allroundexperts

@melvin-bot
Copy link

melvin-bot bot commented Jul 31, 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
Copy link

melvin-bot bot commented Aug 2, 2023

🎯 ⚡️ Woah @allroundexperts / @bernhardoj, great job pushing this forwards! ⚡️

The pull request got merged within 3 working days of assignment, so this job is eligible for a 50% #urgency bonus 🎉

  • when @bernhardoj got assigned: 2023-07-31 12:47:50 Z
  • when the PR got merged: 2023-08-02 17:02:41 UTC

On to the next one 🚀

@rushatgabhane
Copy link
Member

rushatgabhane commented Aug 8, 2023

I don't think this was the current fix

correct fix was done here - #23636 (comment)

we can revert the PR in this issue

@bernhardoj
Copy link
Contributor

bernhardoj commented Aug 8, 2023

It is the correct fix.

Quoting from the linked issue:

However we need to make sure to not assign directly to props.IOU.currency in the useEffect as it is undefined at the first time.

The reason the currency is undefined is because the default props are not applied. That is because we initialized the IOU props to be {errors, loading}. The PR removes that because it is unused. The IOU currency props won't be undefined anymore.

@allroundexperts
Copy link
Contributor

@JmillsExpensify I think this is ready for payment.

@bernhardoj
Copy link
Contributor

@JmillsExpensify bump for payment

@trjExpensify
Copy link
Contributor

👋 @JmillsExpensify can you reduce the payment for @bernhardoj by 50% when you pay this please?

We missed a regression here and I already settled up. Thanks!

@allroundexperts
Copy link
Contributor

@JmillsExpensify Waiting for the payment summary so I can request payment in ND!

@bernhardoj
Copy link
Contributor

@JmillsExpensify hi, is there any update on the payment?

@bernhardoj
Copy link
Contributor

@JmillsExpensify waiting for the payment

@JmillsExpensify
Copy link

Apologies, circling back to this now.

@JmillsExpensify
Copy link

Payment summary:

I'll issue an offer to @bernhardoj based on this amount. Please comment on this issue if you feel that's incorrect.

@JmillsExpensify
Copy link

Then @allroundexperts looks like you owe us a BZ checklist on this issue, including suggestion on regression test.

@JmillsExpensify
Copy link

Alright, Upwork offers are paid out. I'm going to close this issue but I'll still keep tabs on follow-up since I'll have to process a payment for C+ via NewDot.

@allroundexperts
Copy link
Contributor

Checklist

  1. As mentioned in the authors proposal, the issue came from another PR that he did.
  2. N/A
  3. N/A
  4. A regression test would be helpful.

Regression test

  1. Sign out if you are signed in
  2. Go to /request/new
  3. Login and verify that the app does not crash

Do we 👍 or 👎 ?

@JmillsExpensify
Copy link

That seems like a pretty basic regression test. I think it's already covered given that we are testing requesting before each deploy.

@JmillsExpensify
Copy link

$1,500 payment approved for @allroundexperts based on summary above.

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. External Added to denote the issue can be worked on by a contributor Reviewing Has a PR in review Weekly KSv2
Projects
None yet
Development

No branches or pull requests

10 participants