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-10-29] [HOLD for payment 2024-10-25] [$250] The waypoint editor opens as a Not Found page #50961

Closed
1 of 8 tasks
m-natarajan opened this issue Oct 16, 2024 · 39 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

@m-natarajan
Copy link

m-natarajan commented Oct 16, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number:
Reproducible in staging?: need reproduction
Reproducible in production?: needs reproduction
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?:
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: @paultsimura
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1729104627493469

Action Performed:

  1. Go to self-dm
  2. Click "+" -> Track Expense (make sure the first tab that opens is the Distance request – if not, select it, close the RHP and start the Track Expense flow again)
  3. Click the first waypoint

Expected Result:

the waypoint editor opens

Actual Result:

the "Not found" page opens

Workaround:

unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Screen.Recording.2024-10-16.at.20.46.56.mov
Add any screenshot/video evidence

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021846693147955823744
  • Upwork Job ID: 1846693147955823744
  • Last Price Increase: 2024-10-16
Issue OwnerCurrent Issue Owner: @
Issue OwnerCurrent Issue Owner: @trjExpensify
@m-natarajan m-natarajan added Daily KSv2 Needs Reproduction Reproducible steps needed Bug Something is broken. Auto assigns a BugZero manager. labels Oct 16, 2024
Copy link

melvin-bot bot commented Oct 16, 2024

Triggered auto assignment to @trjExpensify (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.

@MelvinBot
Copy link

This has been labelled "Needs Reproduction". Follow the steps here: https://stackoverflowteams.com/c/expensify/questions/16989

@trjExpensify
Copy link
Contributor

Hm, I can't really triage this if it's dev only. @paultsimura adding you as you reported it. 👍

@mkzie2
Copy link
Contributor

mkzie2 commented Oct 16, 2024

Edited by proposal-police: This proposal was edited at 2024-10-16 23:18:43 UTC.

Proposal

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

the "Not found" page opens

What is the root cause of that problem?

Regression from #50772

Not found page in waypoint page would show if there's no waypoints from the draft transaction.

In this case when we get the correct request type:

const transactionRequestType = useRef(TransactionUtils.getRequestType(transaction));

to init the draft transaction where we initialize the optimistic waypoints:

IOU.initMoneyRequest(reportID, policy, isFromGlobalCreate, transactionRequestType.current);

App/src/libs/actions/IOU.ts

Lines 341 to 351 in 3a1d1a8

// Add initial empty waypoints when starting a distance expense
if (iouRequestType === CONST.IOU.REQUEST_TYPE.DISTANCE) {
comment.waypoints = {
waypoint0: {keyForList: 'start_waypoint'},
waypoint1: {keyForList: 'stop_waypoint'},
};
if (!isFromGlobalCreate) {
const customUnitRateID = DistanceRequestUtils.getCustomUnitRateID(reportID);
comment.customUnit = {customUnitRateID};
}
}

At this time the transactionDraft is null causing the transactionRequestType to be manual while it should be distance. This has not been correct all the time.

However, before #50772, we attached a screen listener that triggers onTabSelected right after the component mounts and then call resetIOUTypeIfChanged which eventually initialize the draft transaction with the correct request type (distance):

IOU.initMoneyRequest(reportID, policy, isFromGlobalCreate, newIOUType);

So this works fine on staging and production.

But after #50772, onTabSelected is only triggered when we manually select a new tab:

if (selectedTab === newSelectedTab) {
return;
}

This causes a problem when we previously select a tab, then close the RHP and reopen the RHP, the selectedTab is still the previously selected tab, same for newSelectedTab, and thus onTabSelected is not triggered > resetIOUTypeIfChanged is not called > draft transaction is not init with the correct request type/tab.

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

We should not check the request type barely based on transaction. It is null almost the time since we clearMoneyRequest before starting any request:

const transactionRequestType = useRef(TransactionUtils.getRequestType(transaction));

We can use selectedTab if transaction is undefined:

const transactionRequestType = useMemo(() => !isEmptyObject(transaction) ? TransactionUtils.getRequestType(transaction) : selectedTab, [transaction, selectedTab]);

// Clear out the temporary expense if the reportID in the URL has changed from the transaction's reportID
useEffect(() => {
if (transaction?.reportID === reportID) {
return;
}
IOU.initMoneyRequest(reportID, policy, isFromGlobalCreate, transactionRequestType.current);
}, [transaction, policy, reportID, iouType, isFromGlobalCreate]);

useEffect(() => {
    if (transaction?.reportID === reportID || isLoadingSelectedTab) {
        return;
    }
    IOU.initMoneyRequest(reportID, policy, isFromGlobalCreate, transactionRequestType);
}, [transaction, policy, reportID, iouType, isFromGlobalCreate, isLoadingSelectedTab]);

What alternative solutions did you explore? (Optional)

Or we can enforce the onTabSelected is always triggered on the first render to make sure resetIOUTypeIfChanged is called with the correct request type:

if (selectedTab === newSelectedTab) {
return;
}
Tab.setSelectedTab(id, newSelectedTab as SelectedTabRequest);
onTabSelected(newSelectedTab as IOURequestType);

const didCallOnTabSelectedRef = useRef(true);
if (selectedTab === newSelectedTab && !didCallOnTabSelectedRef.current) {
    return;
}
didCallOnTabSelectedRef.current = false;
Tab.setSelectedTab(id, newSelectedTab as SelectedTabRequest);
onTabSelected(newSelectedTab as IOURequestType);

@mkzie2
Copy link
Contributor

mkzie2 commented Oct 16, 2024

@trjExpensify I think this should be a deploy blocker as a regression from #50772 which will be deployed soon.

@trjExpensify
Copy link
Contributor

Noted: #50772 (comment)

@trjExpensify trjExpensify added the External Added to denote the issue can be worked on by a contributor label Oct 16, 2024
Copy link

melvin-bot bot commented Oct 16, 2024

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

@melvin-bot melvin-bot bot changed the title DEV – The waypoint editor opens as a Not Found page [$250] DEV – The waypoint editor opens as a Not Found page Oct 16, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 16, 2024
Copy link

melvin-bot bot commented Oct 16, 2024

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

@paultsimura
Copy link
Contributor

Thank you for the investigation @mkzie2.
@trjExpensify what is your take here? Do you think we should let the offending PR author @bernhardoj fix this?

🎀👀🎀 C+ reviewed

Copy link

melvin-bot bot commented Oct 17, 2024

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

@bernhardoj
Copy link
Contributor

I left a comment here suggesting to fix this as a separate issue.

@paultsimura
Copy link
Contributor

@bernhardoj, even though the root cause existed before, it only started to affect the flow after your PR. Therefore, it looks like a regression to me 🤔

@trjExpensify
Copy link
Contributor

Yeah, I don't agree that it's a separate issue. That PR now causes users to hit an error page when they open the waypoints editor. We shouldn't send that to prod until it's fixed.

@trjExpensify
Copy link
Contributor

@trjExpensify what is your take here? Do you think we should let the offending PR author @bernhardoj fix this?

Yes, I think it should be treated as a regression personally.

@paultsimura
Copy link
Contributor

Ok then, tagging @rayane-djouah as the original C+ for clarity.

@bernhardoj
Copy link
Contributor

We shouldn't send that to prod until it's fixed.

I agree that we should fix it before reaching prod, but the reason I personally don't think it counts as a regression is, that I or @rayane-djouah wouldn't expect that the money request initialization is not working correctly. It's a hidden bug and never works which is only discovered after the PR. There have been a few cases like this in the past.

In the past, I usually do the follow-up, but it doesn't count as a regression. I suggest treating it as a separate issue since @mkzie2 has already proposed a working solution. I can open the PR but I will borrow the solution above 😅.

@Nodebrute
Copy link
Contributor

@trjExpensify We have another regression from the same pr #51029

@mkzie2
Copy link
Contributor

mkzie2 commented Oct 17, 2024

The PR hit staging. This makes the Submit Scan/Distance expense flow completely malfunctioned and should be fixed with urgency. I can raise PR immediately if needed.

@bernhardoj
Copy link
Contributor

bernhardoj commented Oct 17, 2024

Ok, looks like the init issue causes other flows (#51007 & #51029) too which isn't covered by the proposal, so I'm going to do the follow-up PR. I'll explain all the root causes in the PR here.

@kavimuru
Copy link

Bug is fixed.

Recording.2053.mp4

@marcaaron marcaaron removed the DeployBlockerCash This issue or pull request should block deployment label Oct 17, 2024
Copy link

melvin-bot bot commented Oct 18, 2024

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

Copy link

melvin-bot bot commented Oct 18, 2024

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Hourly KSv2 labels Oct 18, 2024
@melvin-bot melvin-bot bot changed the title [$250] The waypoint editor opens as a Not Found page [HOLD for payment 2024-10-25] [$250] The waypoint editor opens as a Not Found page Oct 18, 2024
Copy link

melvin-bot bot commented Oct 18, 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 Oct 18, 2024
Copy link

melvin-bot bot commented Oct 18, 2024

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

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

Copy link

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

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

@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Oct 22, 2024
@melvin-bot melvin-bot bot changed the title [HOLD for payment 2024-10-25] [$250] The waypoint editor opens as a Not Found page [HOLD for payment 2024-10-29] [HOLD for payment 2024-10-25] [$250] The waypoint editor opens as a Not Found page Oct 22, 2024
Copy link

melvin-bot bot commented Oct 22, 2024

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

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

Copy link

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

  • [@paultsimura] The PR that introduced the bug has been identified. Link to the PR:
  • [@paultsimura] 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:
  • [@paultsimura] 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:
  • [@paultsimura] Determine if we should create a regression test for this bug.
  • [@paultsimura] 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.
  • [@trjExpensify] 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 Overdue and removed Weekly KSv2 labels Oct 25, 2024
Copy link

melvin-bot bot commented Oct 28, 2024

@flodnv, @paultsimura, @trjExpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@trjExpensify
Copy link
Contributor

👋 Checklist time please, @paultsimura!

@melvin-bot melvin-bot bot removed the Overdue label Oct 29, 2024
Copy link

melvin-bot bot commented Oct 29, 2024

Payment Summary

Upwork Job

BugZero Checklist (@trjExpensify)

  • I have verified the correct assignees and roles are listed above and updated the neccesary manual offers
  • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/1846693147955823744/hired)
  • I have paid out the Upwork contracts or cancelled the ones that are incorrect
  • I have verified the payment summary above is correct

@paultsimura
Copy link
Contributor

@trjExpensify this issue turned out to be a regression that got fixed by the original PR authors.
Therefore, there should be no payment here. And if the checklist is still needed, @rayane-djouah was the original C+.

@trjExpensify
Copy link
Contributor

Ah cool, okay. Closing it out then!

Copy link

melvin-bot bot commented Oct 29, 2024

@flodnv @trjExpensify Be sure to fill out the Contact List!

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
Development

No branches or pull requests