App: [Hold for #27168] [$1000] Payments - App crashes when navigating to enable payments page before logging in
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:
- Log out of your account
- Go to `/enable-payments
- Login with another account
Expected Result:
There should be no crash and it should show the page
Actual Result:
The app crashes
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
- Android / native
- Android / Chrome
- iOS / native
- iOS / Safari
- Windows/ Chrome
- MacOS / Desktop
Version Number: 1.3.57-5
Reproducible in staging?: Yes
Reproducible in production?: Yes
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
https://github.com/Expensify/App/assets/78819774/3a064b40-b90f-40fe-842a-fcf29b9900aa
https://github.com/Expensify/App/assets/78819774/fee932fb-4a1d-4b6e-9682-edbe002a9da9
Expensify/Expensify Issue URL:
Issue reported by: @esh-g
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1692372864188139
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~0185374146bc15359c
- Upwork Job ID: 1696179031964413952
- Last Price Increase: 2023-08-28
- Automatic offers:
- cubuspl42 | Reviewer | 26485367
- hoangzinh | Contributor | 26485370
- esh-g | Reporter | 26485371
About this issue
- Original URL
- State: closed
- Created 10 months ago
- Comments: 39 (29 by maintainers)
Conclusion: if you hold for long enough, the issue fixes itself 😅
@cubuspl42 @robertjchen it looks like it’s fixed somewhere. I couldn’t reproduce this issue in the latest main.
https://github.com/Expensify/App/assets/9639873/63c5abd0-5160-4b18-a743-e0b3fd25b0fb
It seems you’re right
This is the GH issue: https://github.com/Expensify/App/issues/27168
Could we please hold this on this bug? I know that the PR is already created, but it’s not our fault that that bug was introduced, and it makes difficult to properly verify the fix for our issue.
Unfortunately, there’s still no GH for the mentioned thing, so we can “[HOLD Broken deeplinks]” or something like that.
I also asked on Slack whether the change is intentional
I think we should check above flag
IS_LOADING_REPORT_DATAbecause it’s a correct signal to check whether the API to fetchpersonalDetailsListdata is completed. Moreover, later on, if the page depends on other needed data in the API above, we can cover it by the single flagIS_LOADING_REPORT_DATAas well.@hungvu193 While the solution might work on the technical level, your root cause analysis is a bit shallow. You focused on what’s happening on the programming language level, not on what’s happening from the broader perspective and why.
@hoangzinh Your root cause analysis sounds reasonable. Could you elaborate a bit on the solution part? As I understand it, the missing (not-yet-loaded) data is the current user personal details. That doesn’t sound like a part of the “report data”, what am I missing? Is the semantics of
IS_LOADING_REPORT_DATAkey different than what could be concluded from the name?Proposal
Please re-state the problem that we are trying to solve in this issue.
Payments - App crashes when navigating to enable payments page before logging in
What is the root cause of that problem?
The error come from this line https://github.com/Expensify/App/blob/c029dc509d03fd13ece058ba89ab25c4318a9050/src/pages/EnablePayments/AdditionalDetailsStep.js#L192 The
currentUserPersonalDetailsis null so it raises error when we call functionextractFirstAndLastNameFromAvailableDetailsThe root cause is because after login, the
OpenAppAPI is not completed yet, so thepersonalDetailsListis not ready yet => We couldn’t get thecurrentUserPersonalDetailsin this line, so it will be null: https://github.com/Expensify/App/blob/c029dc509d03fd13ece058ba89ab25c4318a9050/src/components/withCurrentUserPersonalDetails.js#L39What changes do you think we should make in order to solve the problem?
In the
EnablePaymentsPagecomponent, we should check if the Onyx keyONYXKEYS.IS_LOADING_REPORT_DATAis true, we should display loading page in this line https://github.com/Expensify/App/blob/c029dc509d03fd13ece058ba89ab25c4318a9050/src/pages/EnablePayments/EnablePaymentsPage.js#L53-L55So it only renders child components whenever the
OpenAppdata is ready.