From 4eebb61dc10705b791c4118167d788410eb1be15 Mon Sep 17 00:00:00 2001 From: Nathalie Kuoch Date: Fri, 27 Jan 2023 12:51:50 +0100 Subject: [PATCH 1/2] Add reimbursementpage loader right away --- src/libs/actions/BankAccounts.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libs/actions/BankAccounts.js b/src/libs/actions/BankAccounts.js index 6bc5e6d608d4..db2f416250fb 100644 --- a/src/libs/actions/BankAccounts.js +++ b/src/libs/actions/BankAccounts.js @@ -260,6 +260,8 @@ function validateBankAccount(bankAccountID, validateCode) { } function openReimbursementAccountPage(stepToOpen, subStep, localCurrentStep) { + // Show loader right away, as optimisticData might be set only later in case multiple calls are in the queue + Onyx.merge(ONYXKEYS.REIMBURSEMENT_ACCOUNT, {isLoading: true}); const onyxData = { optimisticData: [ { From 0227168027d57544c35a3b7befabf32fad5e0884 Mon Sep 17 00:00:00 2001 From: Nathalie Kuoch Date: Fri, 27 Jan 2023 15:55:48 +0100 Subject: [PATCH 2/2] Reuse existing method --- src/libs/actions/BankAccounts.js | 2 -- src/pages/ReimbursementAccount/ReimbursementAccountPage.js | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libs/actions/BankAccounts.js b/src/libs/actions/BankAccounts.js index db2f416250fb..6bc5e6d608d4 100644 --- a/src/libs/actions/BankAccounts.js +++ b/src/libs/actions/BankAccounts.js @@ -260,8 +260,6 @@ function validateBankAccount(bankAccountID, validateCode) { } function openReimbursementAccountPage(stepToOpen, subStep, localCurrentStep) { - // Show loader right away, as optimisticData might be set only later in case multiple calls are in the queue - Onyx.merge(ONYXKEYS.REIMBURSEMENT_ACCOUNT, {isLoading: true}); const onyxData = { optimisticData: [ { diff --git a/src/pages/ReimbursementAccount/ReimbursementAccountPage.js b/src/pages/ReimbursementAccount/ReimbursementAccountPage.js index 17c630677ab1..193bf2c9a46b 100644 --- a/src/pages/ReimbursementAccount/ReimbursementAccountPage.js +++ b/src/pages/ReimbursementAccount/ReimbursementAccountPage.js @@ -175,6 +175,9 @@ class ReimbursementAccountPage extends React.Component { * @param {boolean} ignoreLocalCurrentStep Pass true if you want the last "updated" view (from db), not the last "viewed" view (from onyx). */ fetchData(ignoreLocalCurrentStep) { + // Show loader right away, as optimisticData might be set only later in case multiple calls are in the queue + BankAccounts.setReimbursementAccountLoading(true); + // We can specify a step to navigate to by using route params when the component mounts. // We want to use the same stepToOpen variable when the network state changes because we can be redirected to a different step when the account refreshes. const stepToOpen = this.getStepToOpenFromRouteParams();