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-08-09] [$250] Categorizing - Page blinks after selecting a category during categorization #46063

Closed
2 of 6 tasks
lanitochka17 opened this issue Jul 23, 2024 · 32 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

@lanitochka17
Copy link

lanitochka17 commented Jul 23, 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: 9.0.11-0
Reproducible in staging?: Y
Reproducible in production?: N
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Issue reported by: Applause - Internal Team

Action Performed:

Precondition:

  • Account has no workspace
  1. Go to staging.new.expensify.com
  2. Go to self DM
  3. Track a manual expense
  4. Click Categorize it from the actionable whisper
  5. Select any category

Expected Result:

Page will not blink after selecting a category during categorization

Actual Result:

Page blinks after selecting a category during categorization

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

Bug6550721_1721752108588.bandicam_2024-07-24_00-25-27-455.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01f0f7b8664b135266
  • Upwork Job ID: 1815855751043659627
  • Last Price Increase: 2024-07-23
  • Automatic offers:
    • eh2077 | Reviewer | 103288936
Issue OwnerCurrent Issue Owner: @jliexpensify
@lanitochka17 lanitochka17 added DeployBlockerCash This issue or pull request should block deployment DeployBlocker Indicates it should block deploying the API labels Jul 23, 2024
Copy link

melvin-bot bot commented Jul 23, 2024

Triggered auto assignment to @roryabraham (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

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.

@lanitochka17
Copy link
Author

We think that this bug might be related to #vip-vsp

@francoisl
Copy link
Contributor

The flicker is barely noticeable, not sure it's worth blocking on this.

There's also this open issue about the chat view flickering - not sure it's related but could be.

@roryabraham roryabraham added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor and removed DeployBlockerCash This issue or pull request should block deployment DeployBlocker Indicates it should block deploying the API Hourly KSv2 labels Jul 23, 2024
@melvin-bot melvin-bot bot changed the title Categorizing - Page blinks after selecting a category during categorization [$250] Categorizing - Page blinks after selecting a category during categorization Jul 23, 2024
Copy link

melvin-bot bot commented Jul 23, 2024

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

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

melvin-bot bot commented Jul 23, 2024

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

Copy link

melvin-bot bot commented Jul 23, 2024

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

@bernhardoj
Copy link
Contributor

bernhardoj commented Jul 24, 2024

Proposal

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

The page blinks when selecting category in categorize track expense flow.

What is the root cause of that problem?

When we don't have a workspace and trying to categorize an expense, it will open a category page first. Selecting a category will:

  1. Go back
  2. Navigate to confirmation page

if (action === CONST.IOU.ACTION.CATEGORIZE) {
Navigation.goBack();
Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_CONFIRMATION.getRoute(action, iouType, transactionID, report?.reportID ?? '-1'));
return;
}

We go back to close the category selector page. But because the category page is last RHP page at the moment, going back means closing the RHP modal. Then, it's followed by a navigation to a confirmation page, which is an RHP too, so both RHP overlay "conflicting" each other.

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

When the category page is the only route in the navigator, instead of performing a go back and navigate action, we can just replace it with a REPLACE action, which will replace the category page with the confirmation page.

goBack(route, true);

Using goBack with forceFallback to true will do a REPLACE action.

OR

We can use navigate with a type of 'UP'.

To make it reusable, we can create a new function in Navigation lib called closeAndNavigate.

function closeAndNavigate(route: Route) {
    if (!navigationRef.current) return;

    const isFirstRouteInNavigator = !getActiveRouteIndex(navigationRef.current.getState());
    if (isFirstRouteInNavigator) {
        goBack(route, true);
        return;
    }
    goBack();
    navigate(route);
}

@eh2077
Copy link
Contributor

eh2077 commented Jul 24, 2024

@bernhardoj Thanks for the proposal.

Then, it's followed by a navigation to a confirmation page, which is an RHP too, so both RHP overlay "conflicting" each other.

Is it possible to explore a holistic approach? So that we can optimize this typical issue app wide. Maybe we can do some improvements for the navigation manager, wdyt?

@bernhardoj
Copy link
Contributor

Hmm, can you explain more in what thing should we improve? There is 2 navigation action happen in this issue, are you suggesting that if there is a 'back' action followed by a 'navigate' action, then the navigation manager should convert them to 'replace' automatically instead of the developer needs to do it?

@eh2077
Copy link
Contributor

eh2077 commented Jul 24, 2024

are you suggesting that if there is a 'back' action followed by a 'navigate' action, then the navigation manager should convert them to 'replace' automatically instead of the developer needs to do it?

I think so. Does it make sense to you?

@dominictb
Copy link
Contributor

dominictb commented Jul 24, 2024

@eh2077 My proposal has the holistic approach you're looking for!

Proposal

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

Page blinks after selecting a category during categorization

What is the root cause of that problem?

When we go back and navigate here

if (action === CONST.IOU.ACTION.CATEGORIZE) {
Navigation.goBack();
Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_CONFIRMATION.getRoute(action, iouType, transactionID, report?.reportID ?? '-1'));
return;
}
, the category is the only page in the RHN, so the RHN is closed and reopens again and there's a brief period that 2 RHN overlays show at the same time, causing the visible blinking.

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

Create a method replaceRHNScreen like below so that in case the route being replaced is the only one in RHN, we'll use replace and not go back and navigate

const replaceRHNScreen = (currentScreen: string, nextRoute: string) => {
    const rhnInitialScreen = navigationRef.getState().routes.find((routes) => routes.name === NAVIGATORS.RIGHT_MODAL_NAVIGATOR)?.params?.screen;
    
    if (rhnInitialScreen === currentScreen) {
        Navigation.goBack(nextRoute, true);
    } else {
        Navigation.goBack();
        Navigation.navigate(nextRoute);
    }
}

Similar approach to search for a screen in RHN is used here.

Please note in case the route being replaced is not the only one in RHN, we must still use go back and navigate, if not there'll be a regression in the case of [screen A, screen B], if we do replace of screen B in this case, it will become [screen A, screen A], and when go back from screen A it will go to itself. Specifically in this case there'll be regression in case of going from confirmation page to the category, then select another category again.

Then we can replace

Navigation.goBack();
Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_CONFIRMATION.getRoute(action, iouType, transactionID, report?.reportID ?? '-1'));
with

replaceRHNScreen(screen, ROUTES.MONEY_REQUEST_STEP_CONFIRMATION.getRoute(action, iouType, transactionID, report?.reportID ?? '-1'));

The screen used is a child of the route.params that can be added here

What alternative solutions did you explore? (Optional)

Some enhancements to the above check:

  • We can make it more specific by searching in the route tree to the exact route of RHN, in this case the result will be RightModalNavigator -> MoneyRequest -> Money_Request_Step_Category, if Money_Request_Step_Category is the only route in MoneyRequest and MoneyRequest is the only route in RightModalNavigator, we're sure if goBack from Money_Request_Step_Category will lead to RHN closing and we need to use the replace approach
  • Using navigate with 'UP' could also work

@dominictb
Copy link
Contributor

Updated proposal for more details

Copy link

melvin-bot bot commented Jul 26, 2024

Current assignee @roryabraham is eligible for the choreEngineerContributorManagement assigner, not assigning anyone new.

@dominictb
Copy link
Contributor

dominictb commented Jul 26, 2024

My 2 cents:

@dominictb 's #46063 (comment) was posted later (during the discussion on the first proposal) and provides a more completed solution - they discussed detail differences of go back and navigate and replace.

@eh2077 Just to clarify @bernhardoj 's initial proposal causes regressions (the updated proposal has similar approach to mine).

a reusable solution though I believe we'll also get to it in PR.

I agree reusable part could be reached during PR review although it will still cause regressions, the approach suggested in my proposal

Create a method replaceRHNScreen like below so that in case the route being replaced is the only one in RHN, we'll use replace and not go back and navigate

is the only one that's regression free, and is first. My proposal also has correct RCA too.

And the difference between the approaches are major, not minor (my approach involves the first-route-in-RHN check which is not straight-forward or intuitive to figure out).

Looking forward to the final decision from @roryabraham 🙏

@roryabraham
Copy link
Contributor

Well this is a tough call, because both proposals are good and multiple contributors brought value to the issue:

  • @bernhardoj was first to post the root cause
  • @eh2077 provided feedback on the proposal
  • @dominictb was first to create a generalized solution (building off of the root cause and the feedback that was posted)
  • @bernhardoj iterated on his proposal after @dominictb's proposal was posted (definitely a substantive edit, though it's not clear to me that the previous solution would've caused a regression)
  • The final solutions (at the time I'm writing this) are not exactly the same. @dominictb's conditionally uses replace if the screen is the first in the RHP. @bernhardoj conditionally uses replace if the screen is the first in the current navigator. This could mean that @bernhardoj's solution works in LHP or other modals, and not just the RHP. Though it's not clear if we have any use-cases where that would come into play in the app today.

I hope you both can appreciate that I feel like there's no clear answer for which proposal to select; I'm not a perfect judge, and I have to just do my best to consider what's most fair and best for the end-result. In this case I'm going to select @bernhardoj's proposal.

Thank you all for working together to come to a good solution. 🙇🏼

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

melvin-bot bot commented Jul 27, 2024

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

@bernhardoj
Copy link
Contributor

Thanks! 🙇
PR is ready.

cc: @eh2077

@dominictb
Copy link
Contributor

dominictb commented Jul 29, 2024

definitely a substantive edit, though it's not clear to me that the previous solution would've caused a regression

I can provide reproducible steps to show that the previous solution has regressions if necessary.

The final solutions (at the time I'm writing this) are not exactly the same. @dominictb's conditionally uses replace if the screen is the first in the RHP. @bernhardoj conditionally uses replace if the screen is the first in the current navigator. This could mean that @bernhardoj's solution works in LHP or other modals, and not just the RHP. Though it's not clear if we have any use-cases where that would come into play in the app today.

TBH I don't think such a difference is significant in proposal stage, and can be polished in PR phase. So it can be said that the final solution used is mostly influenced from my solution.

because both proposals are good and multiple contributors brought value to the issue:

@roryabraham @eh2077 Would it be more fair if we split the compensation here?

It's fine if not 👍 , I'm just thinking if an alternate arrangement might work better for everyone here, considering the value and efforts both contributors put into helping resolve this are mostly equal.

@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 2, 2024
@melvin-bot melvin-bot bot changed the title [$250] Categorizing - Page blinks after selecting a category during categorization [HOLD for payment 2024-08-09] [$250] Categorizing - Page blinks after selecting a category during categorization Aug 2, 2024
Copy link

melvin-bot bot commented Aug 2, 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 Aug 2, 2024
Copy link

melvin-bot bot commented Aug 2, 2024

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

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

Copy link

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

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

@eh2077
Copy link
Contributor

eh2077 commented Aug 7, 2024

Checklist

  • [@eh2077] The PR that introduced the bug has been identified. Link to the PR: I don't think there's a PR that's responsible for this. It's an edge use case we want to polish.
  • [@eh2077] 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: No
  • [@eh2077] 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: No
  • [@eh2077] Determine if we should create a regression test for this bug. Yes, it's actually a new feature we added though it's an edge case

Regression test

Precondition:

  • Account has no workspace
  1. Go to self DM
  2. Track a manual expense
  3. Click Categorize it from the actionable whisper
  4. Select any category
  5. Verify the confirmation page opens without any blink
  6. Press the Category field to edit it
  7. Change to a different category
  8. Press the back button
  9. Verify the confirmation page closes

@jliexpensify
Copy link
Contributor

Payment Summary

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Aug 8, 2024
@bernhardoj
Copy link
Contributor

Requested in ND.

@JmillsExpensify
Copy link

$250 approved for @bernhardoj

@melvin-bot melvin-bot bot added the Overdue label Aug 12, 2024
@jliexpensify
Copy link
Contributor

Apologies for the delay @eh2077 - paid and job closed!

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

8 participants