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-01-17] [$500] Web - IOU & Task - User is redirected to previous page when double clicking outside RHP editor #33460

Closed
1 of 6 tasks
lanitochka17 opened this issue Dec 21, 2023 · 25 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

@lanitochka17
Copy link

lanitochka17 commented Dec 21, 2023

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.15-4
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: Applause - Internal Team
Slack conversation:

Action Performed:

  1. Go to request details view of IOU/task report
  2. Click on any field to open RHP
  3. Double click outside RHP

Expected Result:

User stays on the same page

Actual Result:

User is returned to previous page

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

Bug6323095_1703186404581.bandicam_2023-12-22_00-55-18-770.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01b870d525be430c1d
  • Upwork Job ID: 1737945433358630912
  • Last Price Increase: 2023-12-21
  • Automatic offers:
    • tienifr | Contributor | 28070388
@lanitochka17 lanitochka17 added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Dec 21, 2023
@melvin-bot melvin-bot bot changed the title Web - IOU & Task - User is redirected to previous page when double clicking outside RHP editor [$500] Web - IOU & Task - User is redirected to previous page when double clicking outside RHP editor Dec 21, 2023
Copy link

melvin-bot bot commented Dec 21, 2023

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

Copy link

melvin-bot bot commented Dec 21, 2023

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

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Dec 21, 2023
Copy link

melvin-bot bot commented Dec 21, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

Copy link

melvin-bot bot commented Dec 21, 2023

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

@gijoe0295
Copy link
Contributor

gijoe0295 commented Dec 21, 2023

Proposal

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

Double clicking overlay navigates back.

What is the root cause of that problem?

This happens to all RHP screens.

We navigate back on pressing the Overlay here:

<View style={styles.RHPNavigatorContainer(isSmallScreenWidth)}>

Since Overlay is wrapped in an animated view, it may not unmount yet, causing onPress to be triggered twice on double clicking.

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

We should create a state/ref to check if onPress has already been triggered before in Overlay. This is to avoid future issues if we reused Overlay.

const onPressWrapper = () => {
  if (!shouldTriggerOnPress) {
      return;
  }
  onPress();
  setShouldTriggerOnPress(false);
}

<PressableWithoutFeedback
  onPress={onPressWrapper}
/>

What alternative solutions did you explore? (Optional)

NA

@ZhenjaHorbach
Copy link
Contributor

ZhenjaHorbach commented Dec 22, 2023

Proposal

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

Web - IOU & Task - User is redirected to previous page when double clicking outside RHP editor

What is the root cause of that problem?

The main problem is that when we click on Overlay
We have time to do it again
As a result we navigate back again

{!isSmallScreenWidth && <Overlay onPress={navigation.goBack} />}

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

We just need to bind the overlay to the navigation state
And as soon as we press on Overlay the first time
The RHP will be out of focus

    const isFocused = useIsFocused(); // Also we can use navigation.isFocused()

    const onPressOverlay = () => {
        if (isFocused) {
            navigation.goBack();
        }
    };

And we won't be able to reuse the overlay

{!isSmallScreenWidth && <Overlay onPress={navigation.goBack} />}

What alternative solutions did you explore? (Optional)

NA

@tienifr
Copy link
Contributor

tienifr commented Dec 22, 2023

Proposal

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

Task - User is redirected to previous page when double clicking outside RHP editor

What is the root cause of that problem?

When press outside RHP, the overlay is not close immediately, so users can press 2 or even more times on overlay

-> navigation.goBack is called many times

{!isSmallScreenWidth && <Overlay onPress={navigation.goBack} />}

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

We should not create the new state to prevent unnecessary re-renders. Beside, onPress is called async so the state may not be updated before the second call

Solution 1: Just create the new ref

const isExecutingRef = useRef<boolean>(false);
<Overlay onPress={()=>{
                if(isExecutingRef.current){
                    return;
                }
                navigation.goBack()
                isExecutingRef.current=true
            }} />

Solution 2: We can edit the hook useSingleExecution

Currently this hook is not supported on web, we can change it as blow

export default function useSingleExecution() {
    const isExecutingRef = useRef<boolean>(false);

    const singleExecution = useCallback(
        <T extends unknown[]>(action: Action<T>) =>
            (...params: T) => {
                if(isExecutingRef.current){
                    return;
                }   
                action(...params);
                isExecutingRef.current = true
            },
        [],
    );

    return {isExecuting: isExecutingRef.current, singleExecution};
}

@gijoe0295
Copy link
Contributor

gijoe0295 commented Dec 22, 2023

Using useSingleExecution for Web can cause this issue: #24482 (comment). I think we should note this in source file to avoid future issues.

@mallenexpensify
Copy link
Contributor

@thesahindia plz review the proposals above.

@melvin-bot melvin-bot bot added the Overdue label Dec 26, 2023
@thesahindia
Copy link
Member

@tienifr's proposal looks good!

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Dec 26, 2023

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

@blimpich
Copy link
Contributor

Sounds good! @tienifr you are assigned, please feel free to create a PR for us to review 🙂

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Dec 26, 2023
Copy link

melvin-bot bot commented Dec 26, 2023

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

@gijoe0295
Copy link
Contributor

gijoe0295 commented Dec 27, 2023

@thesahindia I wonder why I have the same solution but was not selected. The only difference is about using state or ref which is implementation details. There were many proposals that initially proposed using state but then implemented with ref.

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Dec 27, 2023
@mallenexpensify
Copy link
Contributor

@thesahindia can you please provide details on why @tienifr 's proposal was selected above others that were posted before? Thx
@blimpich can you please review the PR?

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Jan 10, 2024
@melvin-bot melvin-bot bot changed the title [$500] Web - IOU & Task - User is redirected to previous page when double clicking outside RHP editor [HOLD for payment 2024-01-17] [$500] Web - IOU & Task - User is redirected to previous page when double clicking outside RHP editor Jan 10, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Jan 10, 2024
Copy link

melvin-bot bot commented Jan 10, 2024

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

Copy link

melvin-bot bot commented Jan 10, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.23-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-01-17. 🎊

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

Copy link

melvin-bot bot commented Jan 10, 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] The PR that introduced the bug has been identified. Link to the PR:
  • [@thesahindia] 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] 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] Determine if we should create a regression test for this bug.
  • [@thesahindia] 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.
  • [@mallenexpensify] 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 Jan 16, 2024
Copy link

melvin-bot bot commented Jan 19, 2024

@blimpich, @mallenexpensify, @thesahindia, @tienifr Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@mallenexpensify
Copy link
Contributor

@thesahindia can you please address my question above?
#33460 (comment)

@thesahindia can you also plz complete the regression test steps?

Contributor: @tienifr paid $500 via Upwork
Contributor+: @thesahindia owed $500 via NewDot

@melvin-bot melvin-bot bot added Overdue and removed Overdue labels Jan 24, 2024
Copy link

melvin-bot bot commented Jan 29, 2024

@blimpich, @mallenexpensify, @thesahindia, @tienifr Huh... This is 4 days overdue. Who can take care of this?

@thesahindia
Copy link
Member

@thesahindia can you please provide details on why @tienifr 's proposal was selected above others that were posted before? Thx

For such minor issues I also look for small details. Since @tienifr suggested the correct implementation details I preferred going with them. Also they added the reason for not using the state and it shows they tested things thoroughly.

@melvin-bot melvin-bot bot removed the Overdue label Jan 29, 2024
@thesahindia
Copy link
Member

Not sure if there's any PR that is responsible for this, I think we can skip the checklist.

We don't need to add a test case. It's a normal flow and the expected behaviour is obvious.

@mallenexpensify
Copy link
Contributor

Thanks @thesahindia !

@JmillsExpensify
Copy link

$500 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
None yet
Development

No branches or pull requests

8 participants