Repository navigation
[HOLD for payment 2023-12-06] [$500] Assign Task - The app crashes when canceling a task in offline mode #31587
Description
Activity
- addedExternalAdded to denote the issue can be worked on by a contributorAdded to denote the issue can be worked on by a contributorDailyKSv2KSv2BugSomething is broken. Auto assigns a BugZero manager.Something is broken. Auto assigns a BugZero manager.
on Nov 20, 2023 - changed the title
[-]Assign Task - The app crashes when canceling a task in offline mode[/-][+][$500] Assign Task - The app crashes when canceling a task in offline mode[/+]on Nov 20, 2023 Triggered auto assignment to @sonialiap (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.Job added to Upwork: https://www.upwork.com/jobs/~01a371f1783ea64c60
Bug0 Triage Checklist (Main S/O)
- This "bug" occurs on a supported platform (ensure
Platformsin 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
- This "bug" occurs on a supported platform (ensure
- addedHelp WantedApply this label when an issue is open to proposals by contributorsApply this label when an issue is open to proposals by contributors
on Nov 20, 2023 Triggered auto assignment to Contributor-plus team member for initial proposal review - @narefyev91 (
External)Proposal
Please re-state the problem that we are trying to solve in this issue.
App crashes on canceling a task in offline mode
What is the root cause of that problem?
The app throws the following err in this line:
Line 761 in f5bfd45
lastVisibleActionCreated: ReportActionsUtils.getLastVisibleAction(parentReport.reportID, optimisticReportActions).created,
this happens because the
getLastVisibleActionfunction returns null in this line with resulting in the prev err:App/src/libs/ReportActionsUtils.ts
Lines 394 to 396 in 80ea5ca
if (sortedReportActions.length === 0) { return null; } What changes do you think we should make in order to solve the problem?
use lodash to access the
.createdprop as we are doing herelastVisibleActionCreated: lodashGet(ReportActionsUtils.getLastVisibleAction(parentReport.reportID, optimisticReportActions),'created'),Proposal
Please re-state the problem that we are trying to solve in this issue.
App crashes when canceling a task in offline mode
What is the root cause of that problem?
When we receive a task and go offline before visiting the task report, this report will have no report action.
So
getLastVisibleActionreturn null
App/src/libs/ReportActionsUtils.ts
Lines 394 to 396 in 8c909d1
if (sortedReportActions.length === 0) { return null; }
and then the app crashes here
Line 761 in 8c909d1
lastVisibleActionCreated: ReportActionsUtils.getLastVisibleAction(parentReport.reportID, optimisticReportActions).created, What changes do you think we should make in order to solve the problem?
If
sortedReportActionsis an empty array we should return an empty object instead of returningnull. That can make sure that all places that usegetLastVisibleActionwill not make the app crash
App/src/libs/ReportActionsUtils.ts
Lines 394 to 396 in 8c909d1
if (sortedReportActions.length === 0) { return null; } We also need to check all places are calling this function to see if it is used like
action.key1.key2we should uselodashGetfor this.What alternative solutions did you explore? (Optional)
Proposal from @abzokhattab looks good to me #31587 (comment)
We should just fix correct usage for lastVisibleActionCreated
Based on this PR https://github.com/Expensify/App/pull/28570/files - we already moved away from returning {} (which will break TS paradigm for that function and may lead to more regressions @dukenv0307 based on your suggestion)
Problem also was not discovered before because not everything are in TS. That's why error was not caught.
Also my suggestion will be to add more unit test here tests/unit/ReportActionsUtilsTest.js for getLastVisibleAction function
🎀 👀 🎀 C+ reviewedReacted by Andrew Rosiclair12 remaining items
- addedAwaiting PaymentAuto-added when associated PR is deployed to productionAuto-added when associated PR is deployed to production
on Nov 29, 2023 - changed the title
[-][$500] Assign Task - The app crashes when canceling a task in offline mode[/-][+][HOLD for payment 2023-12-06] [$500] Assign Task - The app crashes when canceling a task in offline mode[/+]on Nov 29, 2023 Reviewinglabel has been removed, please complete the "BugZero Checklist".The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.4-3 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-12-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:
- @narefyev91 does not require payment (Contractor)
- @abzokhattab requires payment offer (Contributor)
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:
- [@narefyev91] The PR that introduced the bug has been identified. Link to the PR:
- [@narefyev91] 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:
- [@narefyev91] 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:
- [@narefyev91] Determine if we should create a regression test for this bug.
- [@narefyev91] 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.
- [@sonialiap] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
@abzokhattab contributor $500 - paid ✔️
Reacted by Abdelrahman Khattab@narefyev91 please complete the checklist :)
- The PR that introduced the bug has been identified. Link to the PR - was not coming from regression - just missing additional check to prevent crash
- 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 - N/A
- 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 - N/A
Reacted by Sonia LiapounovaThanks!
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: 1.4.1-4
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
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:
Action Performed:
Pre-condition: In LHN task received on previous date with green dot is required
Expected Result:
PAs receiver of task login and cancel task in offline, app must not crash
Actual Result:
The app crashes when canceling a task in offline mode
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
Bug6284569_1700516313998.task.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit