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 2024-05-02] [$250] Track expense - Track expense shortcut doesn't update to the correct one in offline mode #40097

Closed
3 of 6 tasks
izarutskaya opened this issue Apr 11, 2024 · 20 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

@izarutskaya
Copy link

izarutskaya commented Apr 11, 2024

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.62-0
Reproducible in staging?: Y
Reproducible in production?: Y
Logs: https://stackoverflow.com/c/expensify/questions/4856
Issue reported by: Applause-Internal team

Action Performed:

  1. Navigate to staging.new.expensify.com
  2. Track a distance expense
  3. Go offline
  4. Track a manual expense
  5. Click on FAB and observe the shortcut
  6. Go online and do step 5 again

Expected Result:

The shortcut should update to track expense (previously was "track distance").

Actual Result:

Shortcut doesn't update to the recent track action if user is offline

Workaround:

Unknown

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

Bug6445682_1712828866766.bandicam_2024-04-11_12-41-14-620.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01a0bd1968ee14fdd2
  • Upwork Job ID: 1778795114726465536
  • Last Price Increase: 2024-04-12
  • Automatic offers:
    • ikevin127 | Reviewer | 0
    • nkdengineer | Contributor | 0
Issue OwnerCurrent Issue Owner: @sonialiap
@izarutskaya izarutskaya added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Apr 11, 2024
Copy link

melvin-bot bot commented Apr 11, 2024

Triggered auto assignment to @sonialiap (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@izarutskaya
Copy link
Author

We think this issue might be related to the #collect project.

@nkdengineer
Copy link
Contributor

nkdengineer commented Apr 11, 2024

Proposal

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

Shortcut doesn't update to the recent track action if user is offline

What is the root cause of that problem?

In buildOnyxDataForTrackExpense, we don't update the optimistic data of QAB to trackExpense action. After TrackExpense API is complete, BE returns QAB data as trackExpense action. That is the reason why in offline, QAB doesn't update when we create a track expense.

function buildOnyxDataForTrackExpense(

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

In buildOnyxDataForTrackExpense function, we should update optimistic data of QAB as trackExpense action

const isScanRequest = TransactionUtils.isScanRequest(transaction);
const isDistanceRequest = TransactionUtils.isDistanceRequest(transaction);
let newQuickAction: ValueOf<typeof CONST.QUICK_ACTIONS> = CONST.QUICK_ACTIONS.TRACK_MANUAL;
if (isScanRequest) {
    newQuickAction = CONST.QUICK_ACTIONS.TRACK_SCAN
} else if (isDistanceRequest) {
    newQuickAction = CONST.QUICK_ACTIONS.TRACK_DISTANCE
}
optimisticData.push({
    onyxMethod: Onyx.METHOD.SET,
    key: ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE,
    value: {
        action: newQuickAction,
        chatReportID: chatReport?.reportID,
        isFirstQuickAction: isEmptyObject(quickAction),
    },
});

function buildOnyxDataForTrackExpense(

Actually when we click on QAB of track expense, nothing happens because we don't have any case for track expense. It's a known issue and we're handling it in another issue.

What alternative solutions did you explore? (Optional)

NA

@allgandalf
Copy link
Contributor

Proposal

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

Shortcut for track expense doesn't update when we track any expense in offline mode

What is the root cause of that problem?

We do not set quickAction optimistically in buildOnyxDataForTrackExpense and hence when offline, the value isn't stored in onyx and not updated in Quick Action :

function buildOnyxDataForTrackExpense(

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

We need to define newQuickAction in buildOnyxDataForTrackExpense which takes values based on the type of the Track Expense Request and set it accordingly optimistically in Onyx:

    let newQuickAction: ValueOf<typeof CONST.QUICK_ACTIONS> = isScanRequest ? CONST.QUICK_ACTIONS.TRACK_SCAN : CONST.QUICK_ACTIONS.TRACK_MANUAL;

    if (TransactionUtils.isDistanceRequest(transaction)) {
        newQuickAction = CONST.QUICK_ACTIONS.TRACK_DISTANCE;
    }

    optimisticData.push({
        onyxMethod: Onyx.METHOD.SET,
        key: ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE,
        value: {
            action: newQuickAction,
            chatReportID: chatReport?.reportID,
            isFirstQuickAction: isEmptyObject(quickAction),
        },
    });
    

What alternative solutions did you explore? (Optional)

@sonialiap sonialiap added the External Added to denote the issue can be worked on by a contributor label Apr 12, 2024
@melvin-bot melvin-bot bot changed the title Track expense - Track expense shortcut doesn't update to the correct one in offline mode [$250] Track expense - Track expense shortcut doesn't update to the correct one in offline mode Apr 12, 2024
Copy link

melvin-bot bot commented Apr 12, 2024

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Apr 12, 2024
Copy link

melvin-bot bot commented Apr 12, 2024

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

@sonialiap
Copy link
Contributor

@ikevin127 what do you think of the proposals?

@melvin-bot melvin-bot bot removed the Overdue label Apr 15, 2024
@ikevin127
Copy link
Contributor

I'm reviewing the proposals, will get back with a response soon (today)!

@ikevin127
Copy link
Contributor

@nkdengineer's proposal LGTM. It was the first proposal to point out the correct RCA and solution.

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Apr 15, 2024

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

@allgandalf
Copy link
Contributor

opps, I guess my GitHub didn't update at the time of posting my proposal, I saw that no proposal was above me at that time 😆 sorry for the extra work @ikevin127

@ikevin127
Copy link
Contributor

@GandalfGwaihir Your RCA and solution are correct, but the selected proposal was the first to point them out. Additionally, your proposed solution does not bring a significant change compared to the selected proposal as it's simply a slightly different way of writing the code which in essence is doing the same thing.

opps, I guess my GitHub didn't update at the time of posting my proposal, I saw that no proposal was above me at that time 😆 sorry for the extra work @ikevin127

No worries! 😁

@marcochavezf
Copy link
Contributor

Thanks for the review @ikevin127, assigning @nkdengineer 🚀

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Apr 15, 2024
Copy link

melvin-bot bot commented Apr 15, 2024

📣 @ikevin127 🎉 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

Copy link

melvin-bot bot commented Apr 15, 2024

📣 @nkdengineer 🎉 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 melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Apr 16, 2024
@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Apr 25, 2024
@melvin-bot melvin-bot bot changed the title [$250] Track expense - Track expense shortcut doesn't update to the correct one in offline mode [HOLD for payment 2024-05-02] [$250] Track expense - Track expense shortcut doesn't update to the correct one in offline mode Apr 25, 2024
Copy link

melvin-bot bot commented Apr 25, 2024

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

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Apr 25, 2024
Copy link

melvin-bot bot commented Apr 25, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.65-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 2024-05-02. 🎊

For reference, here are some details about the assignees on this issue:

Copy link

melvin-bot bot commented Apr 25, 2024

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:

  • [@ikevin127] The PR that introduced the bug has been identified. Link to the PR:
  • [@ikevin127] 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:
  • [@ikevin127] 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:
  • [@ikevin127] Determine if we should create a regression test for this bug.
  • [@ikevin127] 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:

@ikevin127 ikevin127 mentioned this issue Apr 25, 2024
49 tasks
@ikevin127
Copy link
Contributor

  • [@ikevin127] The PR that introduced the bug has been identified. Link to the PR: Track Expense flow #37282
  • [@ikevin127] 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: Track Expense flow #37282 (comment)
  • [@ikevin127] 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.

No need to start a discussion on this since we already have a checkbox within the PR review checklist related to testing while offline for both PR author and reviewer:

  • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • [@ikevin127] Determine if we should create a regression test for this bug.
  • [@ikevin127] 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.

Regression Test Proposal

  1. Navigate to staging.new.expensify.com.
  2. Click on FAB > Track expense > Distance > submit Track expense.
  3. Click on FAB and ensure that Track distance shortcut is shown indicating most recent Distance expense tracking.
  4. Go offline.
  5. Click on FAB > Track expense > Manual > submit Track expense.
  6. Click on FAB and ensure that Track expense shortcut is shown indicating most recent Manual expense tracking.

Do we agree 👍 or 👎

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels May 1, 2024
@sonialiap
Copy link
Contributor

@ikevin127 $250 paid ✔️
@nkdengineer $250 paid ✔️

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
No open projects
Archived in project
Development

No branches or pull requests

6 participants