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-10-23] [HOLD for payment 2023-10-23] [HOLD for payment 2023-10-20] [HOLD for payment 2023-10-20] [$500] iOS native - App crashes when going back on a Manual request #29114

Closed
1 of 6 tasks
trjExpensify opened this issue Oct 9, 2023 · 40 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@trjExpensify
Copy link
Contributor

trjExpensify commented Oct 9, 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!


Version Number: v1.3.79-3
Reproducible in staging?: Y
Reproducible in production?:
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
Expensify/Expensify Issue URL:
Issue reported by: @MitchExpensify
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1696874025934959

Action Performed:

  1. "+"
  2. "Request money"
  3. Enter manual amount
  4. "Next"
  5. Click a contact (Do not "split")
  6. "<" Go back in the header beside "Manual"
  7. "<" Go back in the header beside "Split"
  8. "Next"

Expected Result:

App doesn't crash

Actual Result:

App crashes

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: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
RPReplay_Final1696873974.mov
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01426d1c07ab30e760
  • Upwork Job ID: 1711444561430691840
  • Last Price Increase: 2023-10-09
  • Automatic offers:
    • aimane-chnaif | Reviewer | 27141426
    • hungvu193 | Contributor | 27141428
@trjExpensify trjExpensify added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Oct 9, 2023
@trjExpensify trjExpensify self-assigned this Oct 9, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 9, 2023

Current assignee @trjExpensify is eligible for the Bug assigner, not assigning anyone new.

@melvin-bot melvin-bot bot changed the title iOS native - App crashes when going back on a Manual request [$500] iOS native - App crashes when going back on a Manual request Oct 9, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 9, 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

@melvin-bot
Copy link

melvin-bot bot commented Oct 9, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01426d1c07ab30e760

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

melvin-bot bot commented Oct 9, 2023

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

@yh-0218
Copy link
Contributor

yh-0218 commented Oct 9, 2023

Proposal

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

App crashes when going back on a Manual request

What is the root cause of that problem?

This error happen on all devices, not only native mobiles.
On native mobiles, app will be crashed.
On chrome, only console error.
The root cause of this error is same screen is appeared when click Next Button.
When click Next Button, we must move to Split screen from Manual Amount Input Screen

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

App/src/libs/actions/IOU.js

Lines 2274 to 2276 in 8d42ad3

if (shouldReset) {
resetMoneyRequestInfo(moneyRequestID);
}

This function reset all request info and go to input screen again.
We need to call secondResetMoneyRequestInfo instead of resetMoneyRequestInfo

function secondResetMoneyRequestInfo(id = '') {
    Onyx.merge(ONYXKEYS.IOU, {
        id,
        billable: null,
    });
}

Result

Screen.Recording.2023-10-09.at.11.10.49.PM.mov
Screen.Recording.2023-10-09.at.11.11.49.PM.mov

What alternative solutions did you explore? (Optional)

@Vadym-33
Copy link

Vadym-33 commented Oct 9, 2023

Proposal

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

App crashes when going back on a Manual request

What is the root cause of that problem?

setTimeout(() => {
this.textInput.focus();
}, CONST.ANIMATED_TRANSITION);

Because of calling focus of null.

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

We can add check logic there and this works very well on my side.

setTimeout(() => {
        if (!this.textInput) {
                return;
        }
         this.textInput.focus();
 }, CONST.ANIMATED_TRANSITION);

What alternative solutions did you explore? (Optional)

@mountiny
Copy link
Contributor

mountiny commented Oct 9, 2023

@aimane-chnaif lets prioritize this one as its important flow in coming 2 weeks. thanks!

@mkhutornyi
Copy link
Contributor

Proposal

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

There are 2 issues here

As first bug is dupe of #28129, I will provide root cause & solution only for 2nd bug here

What is the root cause of that problem?

Participants selector screen uses BaseOptionsSelector component.
It uses setTimeout to autofocus input. But if component is unmounted quickly before 300ms, this.textInput becomes undefined and it tries to call undefined.focus() which makes crash.
This happens because there's no clearTimeout call on component unmount.

setTimeout(() => {
this.textInput.focus();
}, CONST.ANIMATED_TRANSITION);
}

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

We already have clear logic here

componentWillUnmount() {
if (this.focusTimeout) {
clearTimeout(this.focusTimeout);
}

this.focusTimeout definition was somehow missing so we can add it back:

     this.focusTimeout = setTimeout(() => { 
         this.textInput.focus(); 
     }, CONST.ANIMATED_TRANSITION)

@aimane-chnaif
Copy link
Contributor

I can confirm that navigation bug was unintentionally fixed in #27936.
So we can just fix crash here.
@mkhutornyi's proposal looks good to me.
🎀 👀 🎀 C+ reviewed

@melvin-bot
Copy link

melvin-bot bot commented Oct 10, 2023

Triggered auto assignment to @AndrewGable, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@yh-0218
Copy link
Contributor

yh-0218 commented Oct 10, 2023

@aimane-chnaif I think that this crash will not happened if that navigation is fixed.

@aimane-chnaif
Copy link
Contributor

@yh-0218 I faced this many times on the pages where options list is used. We should fix that bug

Here's another reproducible step: click Search icon and Esc key at the same time

Screen.Recording.2023-10-10.at.6.14.54.AM.mov

@hungvu193
Copy link
Contributor

This is dupe of: #28318

cc @fedirjh

@aimane-chnaif
Copy link
Contributor

@hungvu193 no, it's different bug

@hungvu193
Copy link
Contributor

Actually both of it crashed because of the timeout wasn't cleared. I also pointed it out in comment here:
#28318 (comment)

@aimane-chnaif
Copy link
Contributor

Seems like the main purpose of that GH is different from this one - #28318 (comment)
Also what @fedirjh found is different crash - #28318 (comment)

@hungvu193
Copy link
Contributor

It was first created to resolve the console error (which because of the timeout), however while discussing it, @iwiznia pointed out that, we also need to display the NotFoundView instead of do nothing while clicking the deeplink., so I updated the proposal to cover 2 cases.

  1. The console error (which is also this issue)
  2. The NotFoundView when user clicked the link.

So the issue (#28318) can cover this one. Anyway I think let hear other thoughts from @iwiznia and @fedirjh

@trjExpensify
Copy link
Contributor Author

👋 @iwiznia & @fedirjh we haven't really got time to dally on this issue if it's not the same root cause. It's a crash in the middle of the request money flow, and it's going live to TU on Tuesday. Can you check the above, please? In the meantime, @AndrewGable can you put your thoughts on this so we're ready to move forward if we need to.

@fedirjh
Copy link
Contributor

fedirjh commented Oct 11, 2023

I faced this many times on the pages where options list is used. We should fix that bug

@aimane-chnaif It's the same bug initially reported in #28318


@trjExpensify I agree with @hungvu193 that this has the same root cause as #28318 , Also this solution is the same as what @hungvu193 has suggested in #28318 (comment)

@aimane-chnaif
Copy link
Contributor

aimane-chnaif commented Oct 11, 2023

This is what I suggest as this seems like urgent, #28318 is non-urgent. No need to waste time arguing because of issue conflict.

If #28318 will be fixed quickly (in a day or so), go ahead and close this one.
If not, we can do quick fix here for the crash. And implement not found logic separately on #28318.

I just found another crash case on split bill.

@trjExpensify
Copy link
Contributor Author

Yeah, I think we need to get a PR up to fix this crash in the request money flow today, especially if it's also in the split bill case.

I like the idea of using this issue to fix the crash with the above solution, and #28318 to introduce this "no page found" blocking form in the scenario being discussed there.

@mountiny do you agree? We need to resolve this pretty urgently.

@mountiny
Copy link
Contributor

Coming from Slack thread here, going to assing @hungvu193 as their solution was proposed earlier albeit on different issue. it was related.

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Oct 13, 2023
@melvin-bot

This comment was marked as duplicate.

@melvin-bot

This comment was marked as duplicate.

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Oct 13, 2023
@melvin-bot melvin-bot bot changed the title [HOLD for payment 2023-10-20] [$500] iOS native - App crashes when going back on a Manual request [HOLD for payment 2023-10-20] [HOLD for payment 2023-10-20] [$500] iOS native - App crashes when going back on a Manual request Oct 13, 2023
@melvin-bot

This comment was marked as duplicate.

@melvin-bot

This comment was marked as duplicate.

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Oct 16, 2023
@melvin-bot melvin-bot bot changed the title [HOLD for payment 2023-10-20] [HOLD for payment 2023-10-20] [$500] iOS native - App crashes when going back on a Manual request [HOLD for payment 2023-10-23] [HOLD for payment 2023-10-20] [HOLD for payment 2023-10-20] [$500] iOS native - App crashes when going back on a Manual request Oct 16, 2023
@melvin-bot

This comment was marked as duplicate.

@melvin-bot

This comment was marked as duplicate.

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Oct 16, 2023
@melvin-bot melvin-bot bot changed the title [HOLD for payment 2023-10-23] [HOLD for payment 2023-10-20] [HOLD for payment 2023-10-20] [$500] iOS native - App crashes when going back on a Manual request [HOLD for payment 2023-10-23] [HOLD for payment 2023-10-23] [HOLD for payment 2023-10-20] [HOLD for payment 2023-10-20] [$500] iOS native - App crashes when going back on a Manual request Oct 16, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 16, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.84-10 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-10-23. 🎊

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

@melvin-bot

This comment was marked as duplicate.

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 labels Oct 20, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 23, 2023

@AndrewGable, @trjExpensify, @hungvu193, @aimane-chnaif Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@trjExpensify
Copy link
Contributor Author

Can we get the checklist filled out please, @aimane-chnaif? Also, not sure why 4 checklists got triggered. 😅

@aimane-chnaif
Copy link
Contributor

  • The PR that introduced the bug has been identified. Link to the PR: Simplify Global Create menu #25564
  • 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: https://github.com/Expensify/App/pull/25564/files#r1368889880
  • 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: N/A
  • Determine if we should create a regression test for this bug.
  • 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.

This is already added in guideline - https://github.com/Expensify/App/blob/main/contributingGuides/STYLE.md#how-do-i-auto-focus-a-textinput-using-usefocuseffect
If everyone follows this pattern correctly, this bug won't happen.

@aimane-chnaif
Copy link
Contributor

aimane-chnaif commented Oct 23, 2023

Also, not sure why 4 checklists got triggered. 😅

https://expensify.slack.com/archives/C01GTK53T8Q/p1698059102119519 😄

@trjExpensify
Copy link
Contributor Author

Okay, so confirming payments as follows:

#urgency bonus applied as per here.

@trjExpensify
Copy link
Contributor Author

Settled up!

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. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
None yet
Development

No branches or pull requests

9 participants