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

fix: Do not display errors in the Start screen of USD VBA flow #57776

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import ValidateCodeActionModal from '@components/ValidateCodeActionModal';
import useLocalize from '@hooks/useLocalize';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import {getEarliestErrorField, getLatestErrorField} from '@libs/ErrorUtils';
import {getEarliestErrorField, getLatestError, getLatestErrorField} from '@libs/ErrorUtils';
import getPlaidDesktopMessage from '@libs/getPlaidDesktopMessage';
import {REIMBURSEMENT_ACCOUNT_ROUTE_NAMES} from '@libs/ReimbursementAccountUtils';
import WorkspaceResetBankAccountModal from '@pages/workspace/WorkspaceResetBankAccountModal';
Expand Down Expand Up @@ -219,57 +219,55 @@ function VerifiedBankAccountFlowEntryPoint({
</Text>
</View>
)}
<OfflineWithFeedback
errors={errors}
shouldShowErrorMessages
onClose={resetReimbursementAccount}
>
{shouldShowContinueSetupButton === true ? (
<>
<MenuItem
title={translate('workspace.bankAccount.continueWithSetup')}
icon={Connect}
iconFill={theme.icon}
onPress={onContinuePress}
shouldShowRightIcon
wrapperStyle={[styles.cardMenuItem, styles.mt4]}
disabled={!!pendingAction || !isEmptyObject(errors)}
/>
<MenuItem
title={translate('workspace.bankAccount.startOver')}
icon={RotateLeft}
iconFill={theme.icon}
// TODO add method for non USD accounts in next issue - https://github.com/Expensify/App/issues/50912
onPress={requestResetFreePlanBankAccount}
shouldShowRightIcon
wrapperStyle={[styles.cardMenuItem, styles.mt4]}
disabled={!!pendingAction || !isEmptyObject(errors)}
/>
</>
) : (
<>
{!hasForeignCurrency && !shouldShowContinueSetupButton && (
<MenuItem
title={translate('bankAccount.connectOnlineWithPlaid')}
icon={Bank}
iconFill={theme.icon}
disabled={!!isPlaidDisabled}
onPress={handleConnectPlaid}
shouldShowRightIcon
wrapperStyle={[styles.cardMenuItem, styles.mt4]}
/>
)}
{shouldShowContinueSetupButton === true ? (
<OfflineWithFeedback
errors={getLatestError(errors)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a small concern with this function call. Since it relies on timestamps and one error comes from the client and the other from the server, if the client's clock is one second ahead, the order will be reversed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to worry about such an extreme edge case. If you can find a flow which is causing that error somewhat regularly then you can report it as a separate bug.

shouldShowErrorMessages
onClose={resetReimbursementAccount}
>
<MenuItem
title={translate('workspace.bankAccount.continueWithSetup')}
icon={Connect}
iconFill={theme.icon}
onPress={onContinuePress}
shouldShowRightIcon
wrapperStyle={[styles.cardMenuItem, styles.mt4]}
disabled={!!pendingAction || !isEmptyObject(errors)}
/>
<MenuItem
title={translate('workspace.bankAccount.startOver')}
icon={RotateLeft}
iconFill={theme.icon}
// TODO add method for non USD accounts in next issue - https://github.com/Expensify/App/issues/50912
onPress={requestResetFreePlanBankAccount}
shouldShowRightIcon
wrapperStyle={[styles.cardMenuItem, styles.mt4]}
disabled={!!pendingAction || !isEmptyObject(errors)}
/>
</OfflineWithFeedback>
) : (
<>
{!hasForeignCurrency && !shouldShowContinueSetupButton && (
<MenuItem
title={translate('bankAccount.connectManually')}
icon={Connect}
title={translate('bankAccount.connectOnlineWithPlaid')}
icon={Bank}
iconFill={theme.icon}
onPress={handleConnectManually}
disabled={!!isPlaidDisabled}
onPress={handleConnectPlaid}
shouldShowRightIcon
wrapperStyle={[styles.cardMenuItem, styles.mt4]}
/>
</>
)}
</OfflineWithFeedback>
)}
<MenuItem
title={translate('bankAccount.connectManually')}
icon={Connect}
iconFill={theme.icon}
onPress={handleConnectManually}
shouldShowRightIcon
wrapperStyle={[styles.cardMenuItem, styles.mt4]}
/>
</>
)}
</Section>
<View style={[styles.mv0, styles.mh5, styles.flexRow, styles.justifyContentBetween]}>
<TextLink href={CONST.OLD_DOT_PUBLIC_URLS.PRIVACY_URL}>{translate('common.privacy')}</TextLink>
Expand Down