@@ -105,10 +105,12 @@ class ReimbursementAccountPage extends React.Component {
105
105
this . goBack = this . goBack . bind ( this ) ;
106
106
this . requestorStepRef = React . createRef ( ) ;
107
107
108
- // The first time we open this page, the props.reimbursementAccount has not been loaded from the server.
109
- // Calculating shouldShowContinueSetupButton on the default data doesn't make sense, and we should recalculate
108
+ // The first time we open this page, props.reimbursementAccount is either not available in Onyx
109
+ // or only partial data loaded where props.reimbursementAccount.achData.currentStep is not available
110
+ // Calculating shouldShowContinueSetupButton on first page open doesn't make sense, and we should recalculate
110
111
// it once we get the response from the server the first time in componentDidUpdate.
111
- const hasACHDataBeenLoaded = this . props . reimbursementAccount !== ReimbursementAccountProps . reimbursementAccountDefaultProps ;
112
+ const hasACHDataBeenLoaded =
113
+ this . props . reimbursementAccount !== ReimbursementAccountProps . reimbursementAccountDefaultProps && _ . has ( this . props . reimbursementAccount , 'achData.currentStep' ) ;
112
114
this . state = {
113
115
hasACHDataBeenLoaded,
114
116
shouldShowContinueSetupButton : hasACHDataBeenLoaded ? this . getShouldShowContinueSetupButtonInitialValue ( ) : false ,
@@ -183,6 +185,10 @@ class ReimbursementAccountPage extends React.Component {
183
185
Navigation . navigate ( ROUTES . BANK_ACCOUNT_WITH_STEP_TO_OPEN . getRoute ( this . getRouteForCurrentStep ( currentStep ) , policyId , backTo ) ) ;
184
186
}
185
187
188
+ componentWillUnmount ( ) {
189
+ BankAccounts . clearReimbursementAccount ( ) ;
190
+ }
191
+
186
192
getFieldsForStep ( step ) {
187
193
switch ( step ) {
188
194
case CONST . BANK_ACCOUNT . STEP . BANK_ACCOUNT :
0 commit comments