Skip to content

[HOLD for payment 2024-01-17] [$500] Web - IOU & Task - User is redirected to previous page when double clicking outside RHP editor #33460

Closed

Description

@lanitochka17

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

Activity

  1. added
    External
    Daily
    Bug
    on Dec 21, 2023
  2. 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[/+] on Dec 21, 2023
  3. melvin-bot commented on Dec 21, 2023

    @melvin-bot
  4. melvin-bot commented on Dec 21, 2023

    @melvin-bot

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

  5. added
    Help Wanted
    on Dec 21, 2023
  6. melvin-bot commented on Dec 21, 2023

    @melvin-bot

    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
  7. melvin-bot commented on Dec 21, 2023

    @melvin-bot

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

  8. gijoe0295 commented on Dec 21, 2023

    @gijoe0295
    Contributor

    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

  9. ZhenjaHorbach commented on Dec 22, 2023

    @ZhenjaHorbach
    Contributor

    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

  10. tienifr commented on Dec 22, 2023

    @tienifr
    Contributor

    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};
    }
    
  11. gijoe0295 commented on Dec 22, 2023

    @gijoe0295
    Contributor

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

  12. 22 remaining items

  13. melvin-bot commented on Jan 10, 2024

    @melvin-bot

    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:
  14. added
    Daily
    and removed
    Weekly
    on Jan 16, 2024
  15. melvin-bot commented on Jan 19, 2024

    @melvin-bot

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

  16. mallenexpensify commented on Jan 24, 2024

    @mallenexpensify
    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

  17. melvin-bot commented on Jan 29, 2024

    @melvin-bot

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

  18. thesahindia commented on Jan 29, 2024

    @thesahindia
    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.

  19. thesahindia commented on Jan 29, 2024

    @thesahindia
    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.

  20. mallenexpensify commented on Jan 30, 2024

    @mallenexpensify
    Contributor

    Thanks @thesahindia !

  21. JmillsExpensify commented on Apr 10, 2024

    @JmillsExpensify
    Contributor

    $500 approved for @thesahindia

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentBugDailyExternal

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions