From c707b50f47acd879a0b30cae9532a649c0d10303 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Fri, 5 Apr 2024 00:56:34 +0800 Subject: [PATCH 1/5] clear sub step when open bank account page --- .../ReimbursementAccount/ReimbursementAccountPage.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/pages/ReimbursementAccount/ReimbursementAccountPage.js b/src/pages/ReimbursementAccount/ReimbursementAccountPage.js index 0f5d04919e29..bd3290a2be89 100644 --- a/src/pages/ReimbursementAccount/ReimbursementAccountPage.js +++ b/src/pages/ReimbursementAccount/ReimbursementAccountPage.js @@ -263,7 +263,7 @@ function ReimbursementAccountPage({reimbursementAccount, route, onfidoToken, pol * Retrieve verified business bank account currently being set up. * @param {boolean} ignoreLocalCurrentStep Pass true if you want the last "updated" view (from db), not the last "viewed" view (from onyx). */ - function fetchData(ignoreLocalCurrentStep) { + function fetchData(ignoreLocalCurrentStep, ignoreLocalSubStep) { // Show loader right away, as optimisticData might be set only later in case multiple calls are in the queue BankAccounts.setReimbursementAccountLoading(true); @@ -272,12 +272,17 @@ function ReimbursementAccountPage({reimbursementAccount, route, onfidoToken, pol const stepToOpen = getStepToOpenFromRouteParams(route); const subStep = achData.subStep || ''; const localCurrentStep = achData.currentStep || ''; - BankAccounts.openReimbursementAccountPage(stepToOpen, subStep, ignoreLocalCurrentStep ? '' : localCurrentStep, policyID); + BankAccounts.openReimbursementAccountPage(stepToOpen, ignoreLocalSubStep ? '' : subStep, ignoreLocalCurrentStep ? '' : localCurrentStep, policyID); } useEffect( () => { - fetchData(); + // If the step to open is empty, we want to clear the sub step, so the connect option view is shown to the user + const isStepToOpenEmpty = getStepToOpenFromRouteParams(route) === ''; + if (isStepToOpenEmpty) { + BankAccounts.setBankAccountSubStep(null); + } + fetchData(false, isStepToOpenEmpty); return () => { BankAccounts.clearReimbursementAccount(); }; From a8032031441bc5d6cff613d50da82e55828cd1ef Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Fri, 5 Apr 2024 11:15:04 +0800 Subject: [PATCH 2/5] add param to jsdoc --- src/pages/ReimbursementAccount/ReimbursementAccountPage.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/ReimbursementAccount/ReimbursementAccountPage.js b/src/pages/ReimbursementAccount/ReimbursementAccountPage.js index bd3290a2be89..3dbd7681b0c4 100644 --- a/src/pages/ReimbursementAccount/ReimbursementAccountPage.js +++ b/src/pages/ReimbursementAccount/ReimbursementAccountPage.js @@ -262,6 +262,7 @@ function ReimbursementAccountPage({reimbursementAccount, route, onfidoToken, pol /** * Retrieve verified business bank account currently being set up. * @param {boolean} ignoreLocalCurrentStep Pass true if you want the last "updated" view (from db), not the last "viewed" view (from onyx). + * @param {boolean} ignoreLocalSubStep Pass true if you want the last "updated" view (from db), not the last "viewed" view (from onyx). */ function fetchData(ignoreLocalCurrentStep, ignoreLocalSubStep) { // Show loader right away, as optimisticData might be set only later in case multiple calls are in the queue From 7bec8ab39972df9c759fcf5e75237c0beb45d237 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Fri, 19 Apr 2024 23:48:41 +0800 Subject: [PATCH 3/5] update jsdoc --- src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx b/src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx index 4bcdf82c0b9c..22f9afbc16b4 100644 --- a/src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx +++ b/src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx @@ -223,8 +223,8 @@ function ReimbursementAccountPage({ /** * Retrieve verified business bank account currently being set up. - * @param ignoreLocalSubStep Pass true if you want the last "updated" view (from db), not the last "viewed" view (from onyx). * @param ignoreLocalCurrentStep Pass true if you want the last "updated" view (from db), not the last "viewed" view (from onyx). + * @param ignoreLocalSubStep Pass true if you want the last "updated" view (from db), not the last "viewed" view (from onyx). */ function fetchData(ignoreLocalCurrentStep?: boolean, ignoreLocalSubStep?: boolean) { // Show loader right away, as optimisticData might be set only later in case multiple calls are in the queue From 6f5a1d4778a8cdb3abf280757846052cae2aca66 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Wed, 24 Apr 2024 11:40:34 +0800 Subject: [PATCH 4/5] clear plaid event when mounted --- src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx b/src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx index 22f9afbc16b4..edd2155a3c55 100644 --- a/src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx +++ b/src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx @@ -243,6 +243,7 @@ function ReimbursementAccountPage({ const isStepToOpenEmpty = getStepToOpenFromRouteParams(route) === ''; if (isStepToOpenEmpty) { BankAccounts.setBankAccountSubStep(null); + BankAccounts.setPlaidEvent(null); } fetchData(false, isStepToOpenEmpty); // eslint-disable-next-line react-hooks/exhaustive-deps @@ -388,6 +389,7 @@ function ReimbursementAccountPage({ ].some((value) => value === currentStep) ); + console.log('is loading?', {isLoading, isReimbursementAccountLoading, hasACHDataBeenLoaded, plaidCurrentEvent, substep: achData?.subStep}) // Show loading indicator when page is first time being opened and props.reimbursementAccount yet to be loaded from the server // or when data is being loaded. Don't show the loading indicator if we're offline and restarted the bank account setup process // On Android, when we open the app from the background, Onfido activity gets destroyed, so we need to reopen it. From 3dffd6404e2166aae51fcffd10853936583509a6 Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Fri, 26 Apr 2024 13:16:58 +0800 Subject: [PATCH 5/5] remove console log --- src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx b/src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx index edd2155a3c55..9927abb134a0 100644 --- a/src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx +++ b/src/pages/ReimbursementAccount/ReimbursementAccountPage.tsx @@ -389,7 +389,6 @@ function ReimbursementAccountPage({ ].some((value) => value === currentStep) ); - console.log('is loading?', {isLoading, isReimbursementAccountLoading, hasACHDataBeenLoaded, plaidCurrentEvent, substep: achData?.subStep}) // Show loading indicator when page is first time being opened and props.reimbursementAccount yet to be loaded from the server // or when data is being loaded. Don't show the loading indicator if we're offline and restarted the bank account setup process // On Android, when we open the app from the background, Onfido activity gets destroyed, so we need to reopen it.