-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Handle error in workspace's bank account page #15394
Changes from all commits
99df6d7
426694b
7fb58c1
b64bfc3
814df41
5a2fb89
c502f90
5ef05fc
623e3a7
8aea1c2
654d582
3e15034
0bd46f8
a93784b
5218695
ed12f80
c1b12d0
f9a0e34
5425565
2e0bc5d
777f086
332d464
81ab0f4
f51f032
6914f4c
c957618
42dac27
7e36149
85888a7
48585ef
bd11b4c
270dc00
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -266,7 +266,6 @@ function openReimbursementAccountPage(stepToOpen, subStep, localCurrentStep) { | |
onyxMethod: CONST.ONYX.METHOD.MERGE, | ||
key: ONYXKEYS.REIMBURSEMENT_ACCOUNT, | ||
value: { | ||
errors: null, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We re-load the |
||
isLoading: true, | ||
}, | ||
}, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ import PropTypes from 'prop-types'; | |
import React from 'react'; | ||
import {ScrollView} from 'react-native'; | ||
import _ from 'underscore'; | ||
import lodashGet from 'lodash/get'; | ||
import * as Expensicons from '../../components/Icon/Expensicons'; | ||
import * as Illustrations from '../../components/Icon/Illustrations'; | ||
import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize'; | ||
|
@@ -20,6 +21,7 @@ import withPolicy from '../workspace/withPolicy'; | |
import * as ReimbursementAccountProps from './reimbursementAccountPropTypes'; | ||
import WorkspaceResetBankAccountModal from '../workspace/WorkspaceResetBankAccountModal'; | ||
import * as BankAccounts from '../../libs/actions/BankAccounts'; | ||
import OfflineWithFeedback from '../../components/OfflineWithFeedback'; | ||
|
||
const propTypes = { | ||
/** Bank account currently in setup */ | ||
|
@@ -28,9 +30,6 @@ const propTypes = { | |
/** Callback to continue to the next step of the setup */ | ||
continue: PropTypes.func.isRequired, | ||
|
||
/** Callback to reset the bank account */ | ||
startOver: PropTypes.func.isRequired, | ||
|
||
/** Policy values needed in the component */ | ||
policy: PropTypes.shape({ | ||
name: PropTypes.string, | ||
|
@@ -44,55 +43,67 @@ const propTypes = { | |
|
||
const defaultProps = {policyName: ''}; | ||
|
||
const ContinueBankAccountSetup = props => ( | ||
<ScreenWrapper includeSafeAreaPaddingBottom={false}> | ||
<FullPageNotFoundView shouldShow={_.isEmpty(props.policy)}> | ||
<HeaderWithCloseButton | ||
title={props.translate('workspace.common.bankAccount')} | ||
subtitle={props.policyName} | ||
onCloseButtonPress={Navigation.dismissModal} | ||
onBackButtonPress={Navigation.goBack} | ||
shouldShowGetAssistanceButton | ||
guidesCallTaskID={CONST.GUIDES_CALL_TASK_IDS.WORKSPACE_BANK_ACCOUNT} | ||
shouldShowBackButton | ||
/> | ||
<ScrollView style={styles.flex1}> | ||
<Section | ||
title={props.translate('workspace.bankAccount.almostDone')} | ||
icon={Illustrations.BankArrow} | ||
> | ||
<Text> | ||
{props.translate('workspace.bankAccount.youreAlmostDone')} | ||
</Text> | ||
<Button | ||
text={props.translate('workspace.bankAccount.continueWithSetup')} | ||
onPress={props.continue} | ||
icon={Expensicons.Bank} | ||
style={[styles.mv4]} | ||
iconStyles={[styles.buttonCTAIcon]} | ||
shouldShowRightIcon | ||
large | ||
success | ||
/> | ||
<MenuItem | ||
title={props.translate('workspace.bankAccount.startOver')} | ||
icon={Expensicons.RotateLeft} | ||
onPress={() => BankAccounts.requestResetFreePlanBankAccount()} | ||
shouldShowRightIcon | ||
wrapperStyle={[styles.cardMenuItem]} | ||
/> | ||
</Section> | ||
</ScrollView> | ||
</FullPageNotFoundView> | ||
const ContinueBankAccountSetup = (props) => { | ||
const errors = lodashGet(props.reimbursementAccount, 'errors', {}); | ||
const pendingAction = lodashGet(props.reimbursementAccount, 'pendingAction', null); | ||
return ( | ||
<ScreenWrapper includeSafeAreaPaddingBottom={false}> | ||
<FullPageNotFoundView shouldShow={_.isEmpty(props.policy)}> | ||
<HeaderWithCloseButton | ||
title={props.translate('workspace.common.bankAccount')} | ||
subtitle={props.policyName} | ||
onCloseButtonPress={Navigation.dismissModal} | ||
onBackButtonPress={Navigation.goBack} | ||
shouldShowGetAssistanceButton | ||
guidesCallTaskID={CONST.GUIDES_CALL_TASK_IDS.WORKSPACE_BANK_ACCOUNT} | ||
shouldShowBackButton | ||
/> | ||
<ScrollView style={styles.flex1}> | ||
<Section | ||
title={props.translate('workspace.bankAccount.almostDone')} | ||
icon={Illustrations.BankArrow} | ||
> | ||
Comment on lines
+47
to
+65
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks like lots of changes but it is really just an indentation level change + these new variables |
||
<OfflineWithFeedback | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi all! Just dropping a note that this PR caused issue - #18517 Wrapping with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice catch, but with removing the pending action we may lose some other intended strikethough styles? https://github.com/Expensify/App/pull/15394/files#r1119420530 |
||
pendingAction={pendingAction} | ||
errors={errors} | ||
shouldShowErrorMessage | ||
onClose={BankAccounts.resetReimbursementAccount} | ||
Comment on lines
+66
to
+70
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wrapped in
|
||
> | ||
<Text> | ||
{props.translate('workspace.bankAccount.youreAlmostDone')} | ||
</Text> | ||
<Button | ||
text={props.translate('workspace.bankAccount.continueWithSetup')} | ||
onPress={props.continue} | ||
icon={Expensicons.Bank} | ||
style={[styles.mv4]} | ||
iconStyles={[styles.buttonCTAIcon]} | ||
shouldShowRightIcon | ||
large | ||
success | ||
isDisabled={Boolean(pendingAction) || !_.isEmpty(errors)} | ||
/> | ||
<MenuItem | ||
title={props.translate('workspace.bankAccount.startOver')} | ||
icon={Expensicons.RotateLeft} | ||
onPress={() => BankAccounts.requestResetFreePlanBankAccount()} | ||
shouldShowRightIcon | ||
wrapperStyle={[styles.cardMenuItem]} | ||
disabled={Boolean(pendingAction) || !_.isEmpty(errors)} | ||
/> | ||
</OfflineWithFeedback> | ||
</Section> | ||
</ScrollView> | ||
</FullPageNotFoundView> | ||
|
||
{props.reimbursementAccount.shouldShowResetModal && ( | ||
<WorkspaceResetBankAccountModal | ||
reimbursementAccount={props.reimbursementAccount} | ||
onConfirm={props.startOver} | ||
/> | ||
)} | ||
</ScreenWrapper> | ||
); | ||
{props.reimbursementAccount.shouldShowResetModal && ( | ||
<WorkspaceResetBankAccountModal | ||
reimbursementAccount={props.reimbursementAccount} | ||
/> | ||
)} | ||
</ScreenWrapper> | ||
); | ||
}; | ||
|
||
ContinueBankAccountSetup.propTypes = propTypes; | ||
ContinueBankAccountSetup.defaultProps = defaultProps; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was making us navigate first to
/bank-account/BankAccountStep
which is an incorrect url, it should have been/bank-account/
or/bank-account/new
as this what this function is expecting:App/src/pages/ReimbursementAccount/ReimbursementAccountPage.js
Lines 149 to 166 in 332d464