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-09-07] [HOLD for payment 2023-09-06] [$1000] Request money: App Crashes when clicking UP key from keyboard after requesting money #26209

Closed
1 of 6 tasks
izarutskaya opened this issue Aug 29, 2023 · 30 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 Engineering External Added to denote the issue can be worked on by a contributor

Comments

@izarutskaya
Copy link

izarutskaya commented Aug 29, 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. Open the website
  2. click the + icon from LHN
  3. Click request money
  4. Make a request money
  5. Open the IOU report of the requested money
  6. Click UP key from the keyboard
  7. Observe the result

Expected Result:

The app shouldn't be crashed

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
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: v1.3.58-1

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

Screenshare.-.2023-08-29.4_17_36.PM.mp4
Recording.1365.mp4

Expensify/Expensify Issue URL:

Issue reported by: @misgana96

Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1693307519948199

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~017bc5b54c670a647e
  • Upwork Job ID: 1696560199294820352
  • Last Price Increase: 2023-08-29
  • Automatic offers:
    • situchan | Reviewer | 26393982
    • hungvu193 | Contributor | 26393987
    • misgana96 | Reporter | 26393989
@izarutskaya izarutskaya added DeployBlockerCash This issue or pull request should block deployment Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Aug 29, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 29, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 29, 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

@OSBotify
Copy link
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.

@melvin-bot
Copy link

melvin-bot bot commented Aug 29, 2023

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

@hungvu193
Copy link
Contributor

hungvu193 commented Aug 29, 2023

Proposal

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

Request money: App Crashes when clicking UP key from keyboard after requesting money

What is the root cause of that problem?

When press UP action, we will save draft and focus on previous message here:

if (lastReportAction !== -1 && lastReportAction) {
Report.saveReportActionDraft(reportID, lastReportAction.reportActionID, _.last(lastReportAction.message).html);
}

However, in this case, the previous message is not editable, which make our textInputRef is not set, but since the draft is saved. This condition will be trigger and make the crash.
focusTextInputAfterAnimation(textInputRef.current, 100);

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

We should update the logic of canEditReportAction, the created money report action shouldn't be edited.

We should add this condition to our canEditReportAction:

function canEditReportAction(reportAction) {
    const isCommentOrIOU = reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.ADDCOMMENT || reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.IOU;
    return (
        reportAction.actorAccountID === currentUserAccountID &&
        isCommentOrIOU &&
        canEditMoneyRequest(reportAction) && // Returns true for non-IOU actions
        !isReportMessageAttachment(lodashGet(reportAction, ['message', 0], {})) &&
       // shouldn't show edit with created money report action
        !ReportActionsUtils.isCreatedMoneyReportAction(reportAction) &&
        !ReportActionsUtils.isDeletedAction(reportAction) &&
        !ReportActionsUtils.isCreatedTaskReportAction(reportAction) &&
        reportAction.pendingAction !== CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE
    );
}
function isCreatedMoneyReportAction(reportAction) {
    const originalMessage = lodashGet(reportAction, 'originalMessage', {});
    const isSendingMoney = originalMessage.type === CONST.IOU.REPORT_ACTION_TYPE.PAY && _.has(originalMessage, 'IOUDetails');
    return reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.IOU && originalMessage && originalMessage.type === CONST.IOU.REPORT_ACTION_TYPE.CREATE || originalMessage.type === CONST.IOU.REPORT_ACTION_TYPE.SPLIT || isSendingMoney;
}

What alternative solutions did you explore? (Optional)

Keep the logic of the canEditReportAction but we should update the filter here in order to prevent copying from non-editable IOU.

const lastReportAction = _.find([...reportActions, parentReportAction], (action) => ReportUtils.canEditReportAction(action));

const lastReportAction = _.find([...reportActions, parentReportAction], (action) => ReportUtils.canEditReportAction(action)) && !ReportActionsUtils.isCreatedMoneyReportAction(reportAction)

@hungvu193
Copy link
Contributor

hungvu193 commented Aug 29, 2023

cc @mountiny , I think this is regression from this PR: #25429

@mkhutornyi
Copy link
Contributor

Proposal

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

App crashes on IOU report when click UP key from keyboard after requesting money

What is the root cause of that problem?

MoneyRequestPreview is not text-editable action but UP key is applied and trying to be in edit mode

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

It doesn't make sense to change canEditReportAction function as IOU action is still editable and to show edit button in context menu.
Instead we can check if action type is IOU directly here on UP key event:

const lastReportAction = _.find([...reportActions, parentReportAction], (action) => ReportUtils.canEditReportAction(action));

So add one more condition:
&& action.actionName !== CONST.REPORT.ACTION.TYPE.IOU

@situchan
Copy link
Contributor

@hungvu193's alternative solution looks good.
It's intentional to make IOU action editable. We can just prevent UP key making action editable.
I don't believe UP key press should open IOU request page, which is same as from context menu. It will make user confused so bad UX.

@bondydaa
Copy link
Contributor

commented on #26209 asking for guidance

@situchan
Copy link
Contributor

@bondydaa I think @mountiny is on travel right now and not likely to answer soon.
As C+, I am fine to go with #26209 (comment).

@bondydaa bondydaa added the External Added to denote the issue can be worked on by a contributor label Aug 29, 2023
@melvin-bot melvin-bot bot changed the title Request money: App Crashes when clicking UP key from keyboard after requesting money [$1000] Request money: App Crashes when clicking UP key from keyboard after requesting money Aug 29, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 29, 2023

Job added to Upwork: https://www.upwork.com/jobs/~017bc5b54c670a647e

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

melvin-bot bot commented Aug 29, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 29, 2023

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

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 29, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 29, 2023

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

Offer link
Upwork job

@melvin-bot melvin-bot bot added the Weekly KSv2 label Aug 29, 2023
@misgana96
Copy link

Offer accepted. Thank you

@luacmartins
Copy link
Contributor

I'm gonna demote this to NAB. While it isn't great that the App crashes, I think this is enough of an edge case that it won't affect most users. Besides, we also have a PR up which will likely be merged tomorrow.

@luacmartins luacmartins removed the DeployBlockerCash This issue or pull request should block deployment label Aug 29, 2023
@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Aug 29, 2023
@situchan
Copy link
Contributor

I'm gonna demote this to NAB. While it isn't great that the App crashes, I think this is enough of an edge case that it won't affect most users. Besides, we also have a PR up which will likely be merged tomorrow.

But it's bad that once crash happens, always crash even after refresh, until logout and re-login.

I have PR ready
@luacmartins it's up to you whether to merge or not

@melvin-bot
Copy link

melvin-bot bot commented Aug 30, 2023

🎯 ⚡️ Woah @situchan / @situchan, 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 @situchan got assigned: 2023-08-29 16:28:11 Z
  • when the PR got merged: 2023-08-30 00:09:57 UTC

On to the next one 🚀

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Aug 30, 2023
@melvin-bot melvin-bot bot changed the title [$1000] Request money: App Crashes when clicking UP key from keyboard after requesting money [HOLD for payment 2023-09-06] [$1000] Request money: App Crashes when clicking UP key from keyboard after requesting money Aug 30, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Aug 30, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 30, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Aug 30, 2023

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

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
Copy link

melvin-bot bot commented Aug 30, 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:

  • [@situchan] The PR that introduced the bug has been identified. Link to the PR:
  • [@situchan] 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:
  • [@situchan] 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:
  • [@situchan] Determine if we should create a regression test for this bug.
  • [@situchan] 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.
  • [@kevinksullivan] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@mountiny
Copy link
Contributor

Thanks for help here @hungvu193 @situchan this was quite tricky thing to discover.

@kevinksullivan
Copy link
Contributor

@situchan fill out the checklist above when you get a chance. Thanks!

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Aug 31, 2023
@melvin-bot melvin-bot bot changed the title [HOLD for payment 2023-09-06] [$1000] Request money: App Crashes when clicking UP key from keyboard after requesting money [HOLD for payment 2023-09-07] [HOLD for payment 2023-09-06] [$1000] Request money: App Crashes when clicking UP key from keyboard after requesting money Aug 31, 2023
@melvin-bot
Copy link

melvin-bot bot commented Aug 31, 2023

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

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
Copy link

melvin-bot bot commented Aug 31, 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:

  • [@situchan] The PR that introduced the bug has been identified. Link to the PR:
  • [@situchan] 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:
  • [@situchan] 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:
  • [@situchan] Determine if we should create a regression test for this bug.
  • [@situchan] 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.
  • [@kevinksullivan] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Sep 5, 2023
@kevinksullivan
Copy link
Contributor

Paid out, closing.

@kevinksullivan
Copy link
Contributor

Upwork giving me the blank screen contract end bug, so I'll need to come back to this for you @situchan .

image

@kevinksullivan
Copy link
Contributor

@situchan in the meantime, can you complete the steps above?

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

No branches or pull requests

10 participants