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

Wallet - Not here page is opened from "Add payment method" button when app is loading #57619

Open
8 tasks done
lanitochka17 opened this issue Feb 28, 2025 · 3 comments
Open
8 tasks done
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2

Comments

@lanitochka17
Copy link

lanitochka17 commented Feb 28, 2025

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.1.7-1
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A
**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+sj9032@applause.expensifail.com
Issue reported by: Applause - Internal Team

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to Settings > Troubleshoot
  3. Click Clear cache and restart > Reset and refresh
  4. While app is loading, go to Wallet
  5. Click Add payment method

Expected Result:

"Add payment method" button should not be accessible when app is loading

Actual Result:

"Add payment method" button is accessible when app is loading and it leads to not here page

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence
Bug6757600_1740754932943.20250228_225908.mp4

View all open jobs on GitHub

@lanitochka17 lanitochka17 added Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 labels Feb 28, 2025
Copy link

melvin-bot bot commented Feb 28, 2025

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

@FitseTLT
Copy link
Contributor

FitseTLT commented Feb 28, 2025

🚨 Edited by proposal-police: This proposal was edited at 2025-02-28 15:41:14 UTC.

Proposal

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

Wallet - Not here page is opened from "Add payment method" button when app is loading

What is the root cause of that problem?

We display in WalletEmptyState with add payment method button even if the app is loading

<FeatureList
menuItems={WALLET_FEATURES}
illustration={LottieAnimations.FastMoney}
illustrationBackgroundColor={theme.fallbackIconColor}
title={translate('walletPage.getPaidFaster')}
subtitle={translate('walletPage.addPaymentMethod')}
ctaText={translate('paymentMethodList.addPaymentMethod')}
ctaAccessibilityLabel={translate('paymentMethodList.addPaymentMethod')}
onCtaPress={onAddPaymentMethod}
/>

{!!ctaText && (
<Button
text={ctaText}
onPress={onCtaPress}
accessibilityLabel={ctaAccessibilityLabel}
style={styles.w100}
success
large
/>

So the not found page is displayed when pressing add payment because isUserValidated will be false here
const [isUserValidated] = useOnyx(ONYXKEYS.USER, {selector: (user) => !!user?.validated});

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

We have a lot of options: we can either avoid the button or disable (isDisabled) it or display loading indicator (isLoading)) in the button or other approach the Design team suggests when app is loading. (we can also optionally use !isUserValidated condition instead of isLoadingApp as we are displaying the not found page based on !isUserValidated condition)

const [isLoadingApp] = useOnyx(ONYXKEYS.IS_LOADING_APP);

Optionally because WalletEmptyState is used when the user has no payment method yet it might not be appropriate to display it in loading app state so we can optionally display loading indicator in WalletPage when the app is loading like we do in other places like WorkspaceSwitcherPage

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

N / A - UI bug

What alternative solutions did you explore? (Optional)

@truph01
Copy link
Contributor

truph01 commented Mar 1, 2025

Proposal

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

  • "Add payment method" button is accessible when app is loading and it leads to not here page

What is the root cause of that problem?

  • When we clear cache, all the onyx data are cleared (we just preserve a few keys), so the condition to display the WalletEmptyState is true:

    {shouldShowEmptyState ? (
    <WalletEmptyState onAddPaymentMethod={paymentMethodPressed} />

  • In the WalletEmptyState, clicking on the Add payment method button we navigate user to InternationalDepositAccount. In here, it can show AddPersonalBankAccountPage or InternationalDepositAccountContent, based on whether user can use the international bank account (via canUseInternationalBankAccount permission).

  • In case of this bug, user don't have permission to use international bank account, so it opens AddPersonalBankAccountPage page.

  • In when the app is loading, the !user.isUserValidated is true and the not found page is shown.

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

    const [isUserValidated] = useOnyx(ONYXKEYS.USER, {selector: (user) => !!user?.validated});
    const [isLoadingApp] = useOnyx(ONYXKEYS.IS_LOADING_APP);
    const {canUseInternationalBankAccount} = usePermissions();
    const shouldDisableCTA = !canUseInternationalBankAccount && !isUserValidated && isLoadingApp;

the isLoadingApp is optional.

  • The above logic will make sure:
  1. If user can use international bank account, should not disable the CTA since the not here page is not shown in this case.
  2. If user already validated the account, should not disable the CTA since the not here page is not shown in this case.

What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

  • We can render the WalletPage page and mock the onyx data so that the WalletEmptyState is shown then verify that the button is not shown or is disabled.

What alternative solutions did you explore? (Optional)

Option 1:

  • When the app is loading, we can display the loading indicator instead of AddPersonalBankAccountPage in:

if (!canUseInternationalBankAccount) {
return <AddPersonalBankAccountPage />;
}

    if (!canUseInternationalBankAccount) {
        if (isLoadingApp) {
            return <FullScreenLoadingIndicator />;
        }
        return <AddPersonalBankAccountPage />;
    }

like we did in:

if (isAccountLoading) {
return <FullScreenLoadingIndicator />;
}

when the account is loading.

  • We can update the condition for displaying the loading indicator in my suggestion above to isLoadingApp && !user?.validated. This means the loading indicator will only be shown if the app is loading and the user is not validated. If the app is still loading but the user is already validated, we shouldn’t block them from accessing the add bank account page. This is because isLoadingApp can be set to true even when the cache is not cleared.

Option 2:

  • We can show loading indicator in here when the isLoadingApp is true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2
Projects
None yet
Development

No branches or pull requests

4 participants