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-06-11] [$250] Tapping outside quickly after clear status leads the user going back to the report screen #39848

Closed
1 of 6 tasks
m-natarajan opened this issue Apr 8, 2024 · 55 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

@m-natarajan
Copy link

m-natarajan commented Apr 8, 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: 1.4.61-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:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @dukenv0307
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1712306439703269

Action Performed:

  1. Go to Settings > Profile > Status
  2. Change the status and save
  3. Tapping status again
  4. Click on clear status
  5. Tapping outside quickly and notice

Expected Result:

The user should keep the side on the profile page

Actual Result:

The user goes back to report screen

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

Recording.2953.mp4
Screen.Recording.2024-04-05.at.15.35.03.mov

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~014d6d259b4d3f1b08
  • Upwork Job ID: 1777489376165974016
  • Last Price Increase: 2024-04-09
  • Automatic offers:
    • GandalfGwaihir | Contributor | 0
    • nkdengineer | Contributor | 0
Issue OwnerCurrent Issue Owner: @jliexpensify
@m-natarajan m-natarajan added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Apr 8, 2024
Copy link

melvin-bot bot commented Apr 8, 2024

Triggered auto assignment to @jliexpensify (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@FitseTLT
Copy link
Contributor

FitseTLT commented Apr 8, 2024

Proposal

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

Tapping outside quickly after clear status leads the user going back to the report screen

What is the root cause of that problem?

B/c we are navigating back here after interaction

InteractionManager.runAfterInteractions(() => {
navigateBackToPreviousScreen();

when we quickly dismiss modal then it will run goBack on that route opening the report screen instead of the intended dismissing of the status modal

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

we should use dismissModal instead of goBack

            Navigation.dismissModal();

Also apply same change here

navigateBackToPreviousScreen();
});

What alternative solutions did you explore? (Optional)

We can also remove the runAfterInteraction and make the navigation happen immediately

@jliexpensify
Copy link
Contributor

Interesting, I can repro but it doesn't take me to a Report - instead I get taken to my Profile screen. Also on v1.4.61-0

@jliexpensify jliexpensify added the External Added to denote the issue can be worked on by a contributor label Apr 9, 2024
Copy link

melvin-bot bot commented Apr 9, 2024

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

@melvin-bot melvin-bot bot changed the title Tapping outside quickly after clear status leads the user going back to the report screen [$250] Tapping outside quickly after clear status leads the user going back to the report screen Apr 9, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Apr 9, 2024
Copy link

melvin-bot bot commented Apr 9, 2024

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

@jliexpensify
Copy link
Contributor

I also think this shoudl go in #vip-vsb as it deals with Chat Functionality

@allgandalf
Copy link
Contributor

Proposal

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

We are navigated to the last navigated route before profile if we dismiss model quickly after clearing status

What is the root cause of that problem?

When we call clearStatus after the action is performed it will call navigateBackToPreviousScreen which will call the goBack funciton:

const navigateBackToPreviousScreen = useCallback(() => Navigation.goBack(), []);

Now if we have already dismissed the RHP this will take us back to the last accessed route, it can be security tab/preferences/workspaces anything last visited and not limited to reports.

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

We can take help of the isDisplayedInModal function from Navigation:

/** Check if the modal is being displayed */
function isDisplayedInModal() {

This will help us to Check if the modal is being displayed, if the modal is still displayed then we will call the navigateBackToPreviousScreen function, if not then we won't call the function, this will also help us avoid unnecessary function calls to navigateBackToPreviousScreen, so if the Modal/RHP is open then only we will call the goBack function , otherwise we can simply end the function over there and not execute navigateBackToPreviousScreen.

diff --git a/src/pages/settings/Profile/CustomStatus/StatusPage.tsx b/src/pages/settings/Profile/CustomStatus/StatusPage.tsx
index bb7be4a686..0912e610e7 100644
--- a/src/pages/settings/Profile/CustomStatus/StatusPage.tsx
+++ b/src/pages/settings/Profile/CustomStatus/StatusPage.tsx
@@ -107,7 +107,9 @@ function StatusPage({draftStatus, currentUserPersonalDetails}: StatusPageProps)
         formRef.current?.resetForm({[INPUT_IDS.EMOJI_CODE]: ''});
 
         InteractionManager.runAfterInteractions(() => {
-            navigateBackToPreviousScreen();
+            if (Navigation.isDisplayedInModal()) {
+                navigateBackToPreviousScreen();
+            }
         });
     };
 

What alternative solutions did you explore? (Optional)

N/A

@nkdengineer
Copy link
Contributor

nkdengineer commented Apr 9, 2024

Proposal

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

The user goes back to report screen

What is the root cause of that problem?

When we save or clear status, we call goBack function after interaction here. So if we tapping outside quickly before this function is called, we will go back to previous screen which is report screen in this case.

InteractionManager.runAfterInteractions(() => {
navigateBackToPreviousScreen();
});

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

We should cancel the interaction task if it's not called before the StatusPage is unmounted. That will make sure that we will not do the interaction task if this page is already unmounted.

  1. Create a navigateBackToPreviousScreenTask ref
const navigateBackToPreviousScreenTask = useRef<{
    then: (onfulfilled?: () => any, onrejected?: () => any) => Promise<any>;
    done: (...args: any[]) => any;
    cancel: () => void;
} | null>(null);
  1. Assign this ref to the interaction task
navigateBackToPreviousScreenTask.current = InteractionManager.runAfterInteractions(() => {
    navigateBackToPreviousScreen();
});

InteractionManager.runAfterInteractions(() => {

InteractionManager.runAfterInteractions(() => {

  1. Cancel the task if the component is unmounted
useEffect(() => {
    return () => {
        if (!navigateBackToPreviousScreenTask.current) {
            return;
        }

        navigateBackToPreviousScreenTask.current.cancel();
    }
}, [])

What alternative solutions did you explore? (Optional)

NA

@dukenv0307
Copy link
Contributor

@jliexpensify I'm the reporter of this issue, I can take over this as C+.

@jliexpensify
Copy link
Contributor

Hi @dukenv0307 - for fairness sake, I think it would be good to keep this with the auto-assigner. We currently don't have a documented process for what happens if a C+ reports a bug and wishes to be assigned - if you feel that the C+ who reports a bug should be the one assigned, you can present a Problem/Solution statement in #contributor-plus for review by our team and we can add it to our documentation, if we agree.

Also bumping @thesahindia for reviews!

@jliexpensify
Copy link
Contributor

Bumped @thesahindia on Slack, please review. If you're not able to take this on, I'll re-assign the issue.

@thesahindia
Copy link
Member

@GandalfGwaihir's proposal looks good to me!

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Apr 12, 2024

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

@melvin-bot melvin-bot bot removed 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

📣 @GandalfGwaihir 🎉 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 📖

@nkdengineer
Copy link
Contributor

@thesahindia The proposal from @GandalfGwaihir will not correct in this case we clear the status and open quickly any modal by shortcut keyboard like Search page or Short cut modal like this video (I applied the selected solution in this video). We should cancel the interaction task when the component is unmounted that will make sure we will do nothing if the component is unmounted before the interaction task is executed.

cc @youssef-lr

Screen.Recording.2024-04-12.at.22.40.52.mov

@youssef-lr
Copy link
Contributor

Honestly, I'm not sure this is bug is worth fixing right now, how likely is this to be an issue for real world users? cc @jliexpensify

@youssef-lr
Copy link
Contributor

@GandalfGwaihir let's hold off on working on this until we're sure we want to fix this.

@nkdengineer
Copy link
Contributor

@youssef-lr Since the solution to fix all possible cases is very simple, I think we can fix all of this to not face other bugs like this in the further.

@allgandalf
Copy link
Contributor

allgandalf commented Apr 12, 2024

@youssef-lr yeah sure, my branch is ready for PR, let me know once we decide to fix this

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production labels Jun 4, 2024
@melvin-bot melvin-bot bot changed the title [$250] Tapping outside quickly after clear status leads the user going back to the report screen [HOLD for payment 2024-06-11] [$250] Tapping outside quickly after clear status leads the user going back to the report screen Jun 4, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jun 4, 2024
Copy link

melvin-bot bot commented Jun 4, 2024

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

Copy link

melvin-bot bot commented Jun 4, 2024

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

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

Copy link

melvin-bot bot commented Jun 4, 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:

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

@jliexpensify
Copy link
Contributor

jliexpensify commented Jun 5, 2024

New summary, is this correct?

Upwork job

@dukenv0307
Copy link
Contributor

@jliexpensify I think there's a confusion here. I'm a reporter not C+. Should I get paid? Thanks

@jliexpensify
Copy link
Contributor

jliexpensify commented Jun 5, 2024

Aha sorry - I was going off this

Hmm, I don't think we pay out bug reporting anymore but let me double-check.

Asking internally - https://expensify.slack.com/archives/C01SKUP7QR0/p1717558475261729

@jliexpensify
Copy link
Contributor

So we don't pay on bug reporting anymore @dukenv0307 - not sure why Melvin is including you. Apologies!

@thesahindia
Copy link
Member

It was a really minor issue which couldn't have been prevented. Also we don't need a test case here.

@melvin-bot melvin-bot bot added Daily KSv2 Overdue and removed Weekly KSv2 labels Jun 10, 2024
@youssef-lr
Copy link
Contributor

Not overdue

@jliexpensify
Copy link
Contributor

Ah sorry, I missed this one yesterday. Paying today!

@thesahindia and @allgandalf - is there a checklist that needs to be done?

@melvin-bot melvin-bot bot removed the Overdue label Jun 12, 2024
@jliexpensify
Copy link
Contributor

Whoops sorry, ignore me - no checklist needed.

@jliexpensify
Copy link
Contributor

Damn, job is expired. @allgandalf and @nkdengineer - can you accept the offers here?

@allgandalf
Copy link
Contributor

accepted @jliexpensify 👍

@jliexpensify
Copy link
Contributor

Cheers, just waiting on @nkdengineer

@nkdengineer
Copy link
Contributor

Sorry @jliexpensify I don't have any Upwork Connects left so could not apply to the job. Would you mind sending the offer directly to my Upwork profile?

TIA!

@jliexpensify
Copy link
Contributor

@nkdengineer I sent you an offer yesterday, can you see / accept this?

image

@nkdengineer
Copy link
Contributor

@jliexpensify Yes I accepted, thanks

@jliexpensify
Copy link
Contributor

Everyone is paid, and the job is closed! @thesahindia and JMills, please refer to this summary for ND payments.

@JmillsExpensify
Copy link

$250 approved for @thesahindia

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

9 participants