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-29] [$250] Desktop - Onboarding can be skipped by esc key #47189

Closed
1 of 6 tasks
m-natarajan opened this issue Aug 9, 2024 · 40 comments
Closed
1 of 6 tasks
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

@m-natarajan
Copy link

m-natarajan commented Aug 9, 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: v9.0.18-7
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
Email or phone of affected tester (no customers): applausetester+kh050806@applause.expensifail.com
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: Applause internal team
Slack conversation:

Action Performed:

  1. Launch New Expensify desktop app.
  2. Sign up with a new Gmail account.
  3. During onboarding, press esc key.

Expected Result:

Onboarding cannot be skipped by esc key.

Actual Result:

Onboarding can be skipped by esc key.
This issue only happens on desktop app and not web app.

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

Bug6566750_1723214372806.20240809_223636.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0115ed02f53aa4456b
  • Upwork Job ID: 1822029538491322982
  • Last Price Increase: 2024-08-09
  • Automatic offers:
    • dominictb | Contributor | 103496768
Issue OwnerCurrent Issue Owner: @miljakljajic
@m-natarajan m-natarajan added DeployBlockerCash This issue or pull request should block deployment Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. DeployBlocker Indicates it should block deploying the API labels Aug 9, 2024
Copy link

melvin-bot bot commented Aug 9, 2024

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

Copy link

melvin-bot bot commented Aug 9, 2024

Triggered auto assignment to @miljakljajic (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
Contributor

github-actions bot commented Aug 9, 2024

👋 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.

@jasperhuangg
Copy link
Contributor

Man I almost feel like this should be a feature 😆

No need to block deploy, onboarding isn't necessary to use the App, and it only happens on desktop.

@jasperhuangg jasperhuangg added External Added to denote the issue can be worked on by a contributor Daily KSv2 and removed DeployBlockerCash This issue or pull request should block deployment Hourly KSv2 labels Aug 9, 2024
Copy link

melvin-bot bot commented Aug 9, 2024

Job added to Upwork: https://www.upwork.com/jobs/~0115ed02f53aa4456b

@melvin-bot melvin-bot bot changed the title Desktop - Onboarding can be skipped by esc key [$250] Desktop - Onboarding can be skipped by esc key Aug 9, 2024
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 9, 2024
Copy link

melvin-bot bot commented Aug 9, 2024

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

@jasperhuangg jasperhuangg removed the DeployBlocker Indicates it should block deploying the API label Aug 9, 2024
@Krishna2323

This comment was marked as outdated.

@wildan-m
Copy link
Contributor

wildan-m commented Aug 10, 2024

Edited by proposal-police: This proposal was edited at 2024-08-10 07:08:38 UTC.

Proposal

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

Desktop - Onboarding can be skipped by esc key

What is the root cause of that problem?

Onboarding can have several re-renders during initial load, it can be caused by react 18 strict mode or electron internal lifecycle. During this re-render a race condition might occurred in this useEffect.

useEffect(() => {
Modal.setDisableDismissOnEscape(true);
return () => Modal.setDisableDismissOnEscape(false);
}, []);

The disabling process might be called before cleanup code (re-enabling)

It appears this resetRoot not work well for electron, it cause extra render.

const {adaptedState} = getAdaptedStateFromPath(ROUTES.ONBOARDING_ROOT.route, linkingConfig.config);
navigationRef.resetRoot(adaptedState);

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

The key is to execute Modal.setDisableDismissOnEscape(true) at the end and avoid race condition. This can be achieved by wrapping Modal.setDisableDismissOnEscape(true) with InteractionManager.runAfterInteractions.

In src/hooks/useDisableModalDismissOnEscape.ts

import {useEffect} from 'react';
import {InteractionManager} from 'react-native';
import * as Modal from '@userActions/Modal';

export default function useDisableModalDismissOnEscape() {
    useEffect(() => {
        InteractionManager.runAfterInteractions(() => {
            Modal.setDisableDismissOnEscape(true);
        })
        return () => Modal.setDisableDismissOnEscape(false);
    }, []);
}

What alternative solutions did you explore? (Optional)

Change this code

To:

        Welcome.isOnboardingFlowCompleted({
            onNotCompleted: () => {
                Navigation.isNavigationReady().then(() => {
                    Navigation.navigate(ROUTES.ONBOARDING_ROOT.route);
                });
            },
        });

@Krishna2323

This comment was marked as outdated.

@dominictb
Copy link
Contributor

dominictb commented Aug 10, 2024

Edited by proposal-police: This proposal was edited at 2024-08-10 07:14:10 UTC.

Proposal

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

Onboarding can be skipped by esc key.
This issue only happens on desktop app and not web app.

What is the root cause of that problem?

In Desktop, if we try to add the log to:

export default function useDisableModalDismissOnEscape() {
useEffect(() => {
Modal.setDisableDismissOnEscape(true);
return () => Modal.setDisableDismissOnEscape(false);
}, []);
}

    useEffect(() => {
        const instanceId = Math.random().toString(36).substr(2, 5);
        console.log(`Debug: ${instanceId} mounted in Electron`);
        Modal.setDisableDismissOnEscape(true);
        return () => {
            console.log(`Debug: ${instanceId} unmounted in Electron`);
            Modal.setDisableDismissOnEscape(false);
        };
    }, []);

when the onboarding modal is opening, the log result will be:

Debug: v2d51 mounted in Electron
Debug: lkrml mounted in Electron
Debug: v2d51 unmounted in Electron
Debug: j3hps mounted in Electron
Debug: lkrml unmounted in Electron

as we can see, the last one is Debug: lkrml unmounted in Electron, in other words, the Modal.setDisableDismissOnEscape(false) is called at the last time, so when pressing on Esc, the onboarding modal is dismissed.

Here, the log for mounted and unmounted are still being triggered, but they are not synchronized.

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

We should remove this useEffect useDisableModalDismissOnEscape in:


and update:
<RootStack.Screen
name={NAVIGATORS.ONBOARDING_MODAL_NAVIGATOR}
options={onboardingScreenOptions}
component={OnboardingModalNavigator}
/>

                    <RootStack.Screen
                        name={NAVIGATORS.ONBOARDING_MODAL_NAVIGATOR}
                        options={onboardingScreenOptions}
                        component={OnboardingModalNavigator}
                        listeners={{
                            focus: () => {
                                Modal.setDisableDismissOnEscape(true);
                            },
                            beforeRemove: () => Modal.setDisableDismissOnEscape(false),
                        }}

it is the same approach we are using to handle events on other modals.

@wildan-m
Copy link
Contributor

Proposal Updated

  • Add alternative solution

@dominictb
Copy link
Contributor

Proposal udpated:

  • Fix the minor typo issue in RCA and one additional information to RCA.

@jasperhuangg
Copy link
Contributor

FYI @miljakljajic I will be going OOO for the rest of the week so we will likely need to rope in another internal engineer to complete the PR review.

cc @dominictb

@Krishna2323
Copy link
Contributor

Thanks a lot for your understanding @jasperhuangg 🙏🏻. @allroundexperts can you please report the bug in #expensify-bugs channel when the PR for this issue is merged? Thanks

@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Aug 13, 2024
@Krishna2323
Copy link
Contributor

Ignore my previous comment, I was testing on web.

@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 22, 2024
@melvin-bot melvin-bot bot changed the title [$250] Desktop - Onboarding can be skipped by esc key [HOLD for payment 2024-08-29] [$250] Desktop - Onboarding can be skipped by esc key Aug 22, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Aug 22, 2024
Copy link

melvin-bot bot commented Aug 22, 2024

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

Copy link

melvin-bot bot commented Aug 22, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.23-0 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-29. 🎊

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

Copy link

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

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

@Krishna2323
Copy link
Contributor

@Krishna2323 Feel free to report the bug yourself in the #expensify-bugs channel and double-check that the person creating the issue assigns you! Thanks for your investigation.

@allroundexperts, can you please report the other bug in the #expensify-bugs channel and ask the issue creator to assign it to me? I think you should be the C+ there since you have already reviewed this PR and also the solution for the other issue.

@jasperhuangg
Copy link
Contributor

Bump @allroundexperts on above 🙇

@allroundexperts
Copy link
Contributor

@jasperhuangg Do you think that the bug reported by @Krishna2323 is worth solving? If so, can you create a new issue and assign both of us?

Copy link

melvin-bot bot commented Sep 2, 2024

@miljakljajic, @allroundexperts, @jasperhuangg, @dominictb Eep! 4 days overdue now. Issues have feelings too...

@jasperhuangg
Copy link
Contributor

@Krishna2323 Please report the bug yourself via the #expensify-bugs channel. We'll let it go through our standard process.

@Krishna2323
Copy link
Contributor

Thanks. @allroundexperts, could you please do that for me? I don't have access to #expensify-bugs channel.

@miljakljajic
Copy link
Contributor

miljakljajic commented Sep 3, 2024

Payment summary:

@allroundexperts is owed 250 for their work reviewing this PR

@melvin-bot melvin-bot bot removed the Overdue label Sep 3, 2024
@miljakljajic
Copy link
Contributor

@dominictb has been paid in upwork

@JmillsExpensify
Copy link

$250 approved for @allroundexperts

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