From fc5dfe25b89dff8ad092de0d1e5632a80b372a7a Mon Sep 17 00:00:00 2001 From: Justice Arthur Date: Fri, 29 Apr 2022 09:41:40 +0000 Subject: [PATCH 1/3] add refetch actions --- src/pages/ReimbursementAccount/EnableStep.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/pages/ReimbursementAccount/EnableStep.js b/src/pages/ReimbursementAccount/EnableStep.js index a96e495cf8d4..ee910a27ff22 100644 --- a/src/pages/ReimbursementAccount/EnableStep.js +++ b/src/pages/ReimbursementAccount/EnableStep.js @@ -24,11 +24,16 @@ import * as Illustrations from '../../components/Icon/Illustrations'; import * as BankAccounts from '../../libs/actions/BankAccounts'; import * as Link from '../../libs/actions/Link'; import * as User from '../../libs/actions/User'; +import {withNetwork} from '../../components/OnyxProvider'; +import networkPropTypes from '../../components/networkPropTypes'; const propTypes = { /** Are we loading payment methods? */ isLoadingPaymentMethods: PropTypes.bool, + /** Information about the network */ + network: networkPropTypes.isRequired, + /** List of bank accounts */ bankAccountList: PropTypes.objectOf(bankAccountPropTypes), @@ -42,6 +47,18 @@ const defaultProps = { class EnableStep extends React.Component { componentDidMount() { + this.fetchData(); + } + + componentDidUpdate(prevProps) { + if (prevProps.network.isOffline === this.props.network.isOffline) { + return; + } + + this.fetchData(); + } + + fetchData() { PaymentMethods.getPaymentMethods(); } @@ -133,6 +150,7 @@ EnableStep.defaultProps = defaultProps; export default compose( withLocalize, + withNetwork(), withOnyx({ isLoadingPaymentMethods: { key: ONYXKEYS.IS_LOADING_PAYMENT_METHODS, From 56871fa615cb3b22d0dd4ce9e2e340c56dd01bd6 Mon Sep 17 00:00:00 2001 From: Justice Arthur Date: Fri, 29 Apr 2022 18:48:10 +0000 Subject: [PATCH 2/3] apply PR requested changes --- src/pages/ReimbursementAccount/EnableStep.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/ReimbursementAccount/EnableStep.js b/src/pages/ReimbursementAccount/EnableStep.js index ee910a27ff22..8c2ae53cd87e 100644 --- a/src/pages/ReimbursementAccount/EnableStep.js +++ b/src/pages/ReimbursementAccount/EnableStep.js @@ -31,7 +31,7 @@ const propTypes = { /** Are we loading payment methods? */ isLoadingPaymentMethods: PropTypes.bool, - /** Information about the network */ + /** Information about the network */ network: networkPropTypes.isRequired, /** List of bank accounts */ @@ -51,7 +51,7 @@ class EnableStep extends React.Component { } componentDidUpdate(prevProps) { - if (prevProps.network.isOffline === this.props.network.isOffline) { + if (prevProps.network.isOffline && !this.props.network.isOffline) { return; } From 09911676fb32744e94cb3707d5006d5847d196fb Mon Sep 17 00:00:00 2001 From: Justice Arthur Date: Wed, 4 May 2022 11:41:33 +0000 Subject: [PATCH 3/3] update fetch conditino --- src/pages/ReimbursementAccount/EnableStep.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/ReimbursementAccount/EnableStep.js b/src/pages/ReimbursementAccount/EnableStep.js index 8c2ae53cd87e..7c0b58bf0157 100644 --- a/src/pages/ReimbursementAccount/EnableStep.js +++ b/src/pages/ReimbursementAccount/EnableStep.js @@ -51,7 +51,7 @@ class EnableStep extends React.Component { } componentDidUpdate(prevProps) { - if (prevProps.network.isOffline && !this.props.network.isOffline) { + if (!prevProps.network.isOffline || this.props.network.isOffline) { return; }