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-11-20] Search - App navigates to Inbox page when submitting an expense via QAB #50157

Closed
2 of 6 tasks
lanitochka17 opened this issue Oct 3, 2024 · 49 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 Monthly KSv2

Comments

@lanitochka17
Copy link

lanitochka17 commented Oct 3, 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: 9.0.44-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause - Internal Team

Issue found when executing PR #50028

Action Performed:

  1. Login to any account
  2. Switch to the Search page tab
  3. Click the global create button (FAB) > Submit expense > Manual > Enter amount > Choose recipient and submit
  4. Notice that you remain on the search page
  5. Click on the FAB button again > Quick Action Button > Enter amount and submit

Expected Result:

The user remains on the search page and the newly added expense appears in the table and the row is briefly highlighted

Actual Result:

The user is navigated to inbox page, there is an inconsistency when submitting an expense via FAB and QAB

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

Add any screenshot/video evidence
Bug6623276_1727964658628.2024-10-03_17_07_56.mp4

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @trjExpensify
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Oct 3, 2024
Copy link

melvin-bot bot commented Oct 3, 2024

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

@lanitochka17
Copy link
Author

@slafortune FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

@lanitochka17
Copy link
Author

We think that this bug might be related to #wave-control

@trjExpensify
Copy link
Contributor

Yep, like the create options, we'd want someone using the QAB to remain on the search page if they created from the search page as well.

@mananjadhav can you take this?

@trjExpensify trjExpensify moved this to Release 2.5: SuiteWorld (Sept 9th) in [#whatsnext] #wave-collect Oct 3, 2024
@mananjadhav
Copy link
Collaborator

Will take this up.

@mananjadhav
Copy link
Collaborator

I have a solution that works. This definitely seems to be related to Navigation so I was verifying if it would break something. I also feel we should get an opinion from the expert agency as it relates to Navigation.

Proposal

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

  • When we click on the "Quick action" from search or other pages on FAB, it navigates to "Inbox" page.

What is the root cause of that problem?

  • We're calling IOU.startMoneyRequest with parameters IOU.startMoneyRequest(CONST.IOU.TYPE.SUBMIT, quickActionReportID, CONST.IOU.REQUEST_TYPE.MANUAL, true).
  • When this is called, the navigation path doesn't directly called the /create/submit/start/{reportId}/manual. Instead this calls /create/submit/{reportId}?initial=true&screen=scan&params=object&path=/create/submit/start/.... I think this is related to the linkTo implementation.

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

switch (quickAction?.action) {
case CONST.QUICK_ACTIONS.REQUEST_MANUAL:
selectOption(() => IOU.startMoneyRequest(CONST.IOU.TYPE.SUBMIT, quickActionReportID, CONST.IOU.REQUEST_TYPE.MANUAL, true), true);
return;
case CONST.QUICK_ACTIONS.REQUEST_SCAN:
selectOption(() => IOU.startMoneyRequest(CONST.IOU.TYPE.SUBMIT, quickActionReportID, CONST.IOU.REQUEST_TYPE.SCAN, true), true);
return;
case CONST.QUICK_ACTIONS.REQUEST_DISTANCE:
selectOption(() => IOU.startMoneyRequest(CONST.IOU.TYPE.SUBMIT, quickActionReportID, CONST.IOU.REQUEST_TYPE.DISTANCE, true), true);
return;
case CONST.QUICK_ACTIONS.SPLIT_MANUAL:
selectOption(() => IOU.startMoneyRequest(CONST.IOU.TYPE.SPLIT, quickActionReportID, CONST.IOU.REQUEST_TYPE.MANUAL, true), true);
return;
case CONST.QUICK_ACTIONS.SPLIT_SCAN:
selectOption(() => IOU.startMoneyRequest(CONST.IOU.TYPE.SPLIT, quickActionReportID, CONST.IOU.REQUEST_TYPE.SCAN, true), true);
return;
case CONST.QUICK_ACTIONS.SPLIT_DISTANCE:
selectOption(() => IOU.startMoneyRequest(CONST.IOU.TYPE.SPLIT, quickActionReportID, CONST.IOU.REQUEST_TYPE.DISTANCE, false), true);
return;
case CONST.QUICK_ACTIONS.SEND_MONEY:
selectOption(() => IOU.startMoneyRequest(CONST.IOU.TYPE.PAY, quickActionReportID, CONST.IOU.REQUEST_TYPE.MANUAL, true), false);
return;
case CONST.QUICK_ACTIONS.ASSIGN_TASK:
selectOption(() => Task.startOutCreateTaskQuickAction(isValidReport ? quickActionReportID : '', quickAction.targetAccountID ?? -1), false);
break;
case CONST.QUICK_ACTIONS.TRACK_MANUAL:
selectOption(() => IOU.startMoneyRequest(CONST.IOU.TYPE.TRACK, quickActionReportID, CONST.IOU.REQUEST_TYPE.MANUAL, true), false);
break;
case CONST.QUICK_ACTIONS.TRACK_SCAN:
selectOption(() => IOU.startMoneyRequest(CONST.IOU.TYPE.TRACK, quickActionReportID, CONST.IOU.REQUEST_TYPE.SCAN, true), false);
break;
case CONST.QUICK_ACTIONS.TRACK_DISTANCE:
selectOption(() => IOU.startMoneyRequest(CONST.IOU.TYPE.TRACK, quickActionReportID, CONST.IOU.REQUEST_TYPE.DISTANCE, true), false);
break;

The reason I suggested this is because we the function startMoneyRequest has four parameters (iouType: ValueOf<typeof CONST.IOU.TYPE>, reportID: string, requestType?: IOURequestType, skipConfirmation = false) but across the application we never use the requestType argument.

Here's a quick video of the implementation.

Screen.Recording.2024-10-04.at.12.25.03.AM.mov

What alternative solutions did you explore? (Optional)

  • Fix this at the navigation level.

@c3024
Copy link
Contributor

c3024 commented Oct 4, 2024

Proposal

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

BottomTab and CentralPane change when we open RHP with QAB in Search Central Pane.

What is the root cause of that problem?

When we start the flow with QAB the report in the URL param is a valid report and it finds a matching route for RHP route here.

if (ReportConnection.getAllReports()?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]?.reportID) {
return {name: SCREENS.REPORT, params: {reportID}};
}

and this is pushed to routes with metaInfo as true here.
if (matchingRootRoute && (!isNarrowLayout || !isRHPScreenOpenedFromLHN)) {
routes.push(matchingRootRoute);
}
}
routes.push(rhpNavigator);
return {
adaptedState: getRoutesWithIndex(routes),
metainfo,
};
}

Since metaInfo fields are both true, we find if there are diff actions that need to be dispatched here and we dispatch them.
const {adaptedState, metainfo} = getAdaptedStateFromPath(path, linkingConfig.config);
if (adaptedState && (metainfo.isCentralPaneAndBottomTabMandatory || metainfo.isFullScreenNavigatorMandatory)) {
const diff = getPartialStateDiff(rootState, adaptedState as State<RootStackParamList>, metainfo);
const diffActions = getActionsFromPartialDiff(diff);
for (const diffAction of diffActions) {
root.dispatch(diffAction);
}
}

In this case, the bottom tab navigators and central panes are different (Search_Bottom_Tab/Home and Search_Central_Pane and Report respectively). So, these diffs are dispatched which cause the QAB report and Home to be added for the Central Pane and Bottom Tab respectively.

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

When on Search_Central_Pane I have not found any cases where we need to change the bottom tab or central pane when opening RHP. So we can dispatch the diffs only when when do not open the RHP when on Search Central Pane.
So, we can wrap this in a check

// If this RHP has mandatory central pane and bottom tab screens defined we need to push them.
const {adaptedState, metainfo} = getAdaptedStateFromPath(path, linkingConfig.config);
if (adaptedState && (metainfo.isCentralPaneAndBottomTabMandatory || metainfo.isFullScreenNavigatorMandatory)) {
const diff = getPartialStateDiff(rootState, adaptedState as State<RootStackParamList>, metainfo);
const diffActions = getActionsFromPartialDiff(diff);
for (const diffAction of diffActions) {
root.dispatch(diffAction);
}
}

 if (!(isSideModalNavigator(action.payload.name) && lastRoute?.name === "Search_Central_Pane")) {
            const {adaptedState, metainfo} = getAdaptedStateFromPath(path, linkingConfig.config);
            if (adaptedState && (metainfo.isCentralPaneAndBottomTabMandatory || metainfo.isFullScreenNavigatorMandatory)) {
                const diff = getPartialStateDiff(rootState, adaptedState as State<RootStackParamList>, metainfo);
                const diffActions = getActionsFromPartialDiff(diff);
                for (const diffAction of diffActions) {
                    root.dispatch(diffAction);
                }
            }
}

What alternative solutions did you explore? (Optional)

@c3024
Copy link
Contributor

c3024 commented Oct 4, 2024

I can work on this as contributor and @mananjadhav as C+ if this solution above looks good.

@mananjadhav
Copy link
Collaborator

I was working on a solution to update linkTo. Let me review your proposal.

@mananjadhav
Copy link
Collaborator

mananjadhav commented Oct 4, 2024

Yeah I think @c3024's solution works.

where we need to change the bottom tab or central pane when opening RHP.

Just need to clarify this. Otherwise we'll need to modify the startMoneyRequest calls as I recommended.

@c3024
Copy link
Contributor

c3024 commented Oct 4, 2024

My bad! My solution is not good enough. The issue can happen when we click on QAB from other pages like the settings page with related centre panes.

I think we should keep a global value for tracking if we clicked on QAB and just ignore adding the report here

if (ReportConnection.getAllReports()?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]?.reportID) {
return {name: SCREENS.REPORT, params: {reportID}};
}

even if it matches with an existing report like this.

@trjExpensify
Copy link
Contributor

trjExpensify commented Oct 4, 2024

How did we approach this for the create flow when actioned from the search page, wouldn't we follow that? I.e if you're on the search page and choose Submit expense or the QAB, the outcome is the same on completion. You remain on the search page, and the expense is highlighted in the table.

@c3024
Copy link
Contributor

c3024 commented Oct 4, 2024

We generate the navigation state required based on the URL. When we use QAB, we have a valid report ID in the URL. In normal cases (that is, other than QAB), we do not have a valid report ID in the URL. The report is chosen on the participants' page.

When we deeplink into an RHP flow and the URL has an existing report ID, we show the report as an underlay when we navigate to it. Therefore, we add this report screen to the navigation state when the URL has an existing report ID.

The URL is the same for the QAB flow as well, so our navigation code pushes the existing report to the central pane, and this navigation to a different bottom navigator (HOME) and central pane (REPORT) occurs. When we click on the normal 'Submit Expense' flow, there is no valid report ID in the URL, and no report route is pushed into the state. This is peculiar to QAB alone due to the initial URL having a valid report ID.

@c3024
Copy link
Contributor

c3024 commented Oct 4, 2024

The bug occurs in other pages also, not just in the Search Page.

Screen.Recording.2024-10-04.at.3.54.58.PM.mov

@mananjadhav
Copy link
Collaborator

How did we approach this for the create flow when actioned from the search page, wouldn't we follow that?

@c3024 is right. I think it's just how we've implemented @trjExpensify. Hence we have both the options. Either we go ahead an update the Navigation which @c3024 has recommended or what you asked and that's what my proposal does.

@trjExpensify
Copy link
Contributor

I think it's just how we've implemented @trjExpensify.

Sorry to be clear, this "stay on the search page if you Submit expense from the search page" feature is a relatively new feature in the last couple of weeks. So I was wondering how that was implemented, and why we can't do the same for the QAB. CC: @ikevin127 who might have some context on this to chime in as well.

@melvin-bot melvin-bot bot added the Overdue label Oct 7, 2024
@trjExpensify
Copy link
Contributor

Whatcha' think @mananjadhav?

@melvin-bot melvin-bot bot removed the Overdue label Oct 8, 2024
@mananjadhav
Copy link
Collaborator

I think we need to decide whether we want to update the navigation for this. I feel we should do that.

We have both the proposals and I think we should ask an internal engineer to decide this.

🎀 👀 🎀 C+ reviewed (adding this to assign an internal engineer). We can decide between @c3024 or me to implement + review the PR.

Copy link

melvin-bot bot commented Oct 9, 2024

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

@mananjadhav
Copy link
Collaborator

I posted one yesterday on the PR itself here. I'll have it raised by tomorrow.

@melvin-bot melvin-bot bot added the Overdue label Oct 24, 2024
@trjExpensify
Copy link
Contributor

Thanks, any luck?

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

melvin-bot bot commented Oct 25, 2024

@francoisl, @mananjadhav, @trjExpensify, @c3024 Whoops! This issue is 2 days overdue. Let's get this updated quick!

@mananjadhav
Copy link
Collaborator

I am left with one last withOnyx update and I need to modify the selector.

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Oct 25, 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 Nov 13, 2024
@melvin-bot melvin-bot bot changed the title Search - App navigates to Inbox page when submitting an expense via QAB [HOLD for payment 2024-11-20] Search - App navigates to Inbox page when submitting an expense via QAB Nov 13, 2024
Copy link

melvin-bot bot commented Nov 13, 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 Nov 13, 2024
Copy link

melvin-bot bot commented Nov 13, 2024

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

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

  • @mananjadhav requires payment through NewDot Manual Requests
  • @c3024 requires payment (Needs manual offer from BZ)

Copy link

melvin-bot bot commented Nov 13, 2024

@mananjadhav / @c3024 @trjExpensify @mananjadhav / @c3024 The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot melvin-bot bot added Daily KSv2 Monthly KSv2 and removed Weekly KSv2 labels Nov 19, 2024
Copy link

melvin-bot bot commented Nov 20, 2024

Payment Summary

Upwork Job

  • Reviewer: @mananjadhav owed $250 via NewDot
  • ROLE: @c3024 paid $(AMOUNT) via Upwork (LINK)

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//hired)
  • I have paid out the Upwork contracts or cancelled the ones that are incorrect
  • I have verified the payment summary above is correct

@trjExpensify
Copy link
Contributor

Checklist time, @mananjadhav!

@mananjadhav
Copy link
Collaborator

I thought @c3024 would take care of it as the reviewer.

I checked the code and I don't think we have an offending PR for this one. But I do feel we should add a regression test step for this.

Regression Test Proposal

  1. Login to any account
  2. Switch to the Search page tab
  3. Click the global create button (FAB) > Submit expense > Manual > Enter amount > Choose recipient and submit.
  4. Notice that you remain on the search page.
  5. Click on the FAB button again > Quick Action Button > Enter amount and submit.
  6. The user remains on the search page and the newly added expense appears in the table.

wdyt?

@c3024
Copy link
Contributor

c3024 commented Nov 21, 2024

I thought @c3024 would take care of it as the reviewer.

Yea, I missed that this was due for payment yesterday.

Thanks for handling it!

@trjExpensify
Copy link
Contributor

Oh sorry, I assumed you were the reviewer haha.

Payment summary as follows:

  • $250 to @mananjadhav for the fix (go ahead and request!)
  • $250 to @c3024 for the review (offer sent!)

@trjExpensify
Copy link
Contributor

Paid, closing!

@mananjadhav
Copy link
Collaborator

Yea, I missed that this was due for payment yesterday.

No worries at all bro!

thanks @trjExpensify

@garrettmknight
Copy link
Contributor

$250 approved for @mananjadhav

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 Monthly KSv2
Projects
Status: Release 2.5: SuiteWorld (Sept 9th)
Development

No branches or pull requests

7 participants