Skip to content
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

[$1000] Not showing loader on add bank account page #14425

Closed
6 tasks
kavimuru opened this issue Jan 19, 2023 · 16 comments
Closed
6 tasks

[$1000] Not showing loader on add bank account page #14425

kavimuru opened this issue Jan 19, 2023 · 16 comments
Assignees
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors

Comments

@kavimuru
Copy link

kavimuru commented Jan 19, 2023

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Action Performed:

  1. Open settings -> Payments.
  2. Press on Add payment method -> Bank account.
  3. Observe loader is not display.

Expected Result:

Loader should be display until preparing Plaid link.

Actual Result:

Loader not showing on add bank account

Workaround:

unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.2.56-0
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos:

no-loader.1.mov
Recording.1334.mp4

Expensify/Expensify Issue URL:
Issue reported by: @jatinsonijs
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1674055957380549

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~017a4fe2b93e051102
  • Upwork Job ID: 1616549263858544640
  • Last Price Increase: 2023-01-20
@kavimuru kavimuru added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jan 19, 2023
@melvin-bot melvin-bot bot locked and limited conversation to collaborators Jan 19, 2023
@arielgreen
Copy link
Contributor

arielgreen commented Jan 20, 2023

Bug0 Triage Checklist

Note: see this SO for more information.

  • The "bug" is actually a bug
  • The bug is not a duplicate report of an existing GH.
    • If it is, close the GH and add any novel details to the original GH instead
  • The bug is reproducible, following the reproduction steps.
    • [ ] If the GH doesn’t have steps to reliably reproduce the bug and you figure it out, then please add them.
    • [ ] If you’re unable to reproduce the bug, add the Needs reproduction label.
    • [ ] Comment on the issue outlining the steps you took to try to reproduce the bug, your results and tag the issue reporter and the Applause QA member who created the issue. Ask them to clarify reproduction steps and/or to check the reproduction steps again. Close issue.
  • The GH template is filled out as fully as possible
    • The GH body and title are clear (ie. could an external contributor understand it and work on it?)
  • The GH was created by an Expensify employee or a QA tester
  • [ ] If the bug is an OldDot issue, you should decide whether it is widespread enough to justify fixing or it is better to wait for reunification. If it’s better to wait, close the GH & provide this justification
  • If there's a link to Slack, check the discussion to see if we decided not to fix it
  • Decide if the GH should be resolved by an External contributor or Internal engineer, add the appropriate label

@arielgreen arielgreen added the External Added to denote the issue can be worked on by a contributor label Jan 20, 2023
@melvin-bot melvin-bot bot unlocked this conversation Jan 20, 2023
@melvin-bot melvin-bot bot changed the title Not showing loader on add bank account page [$1000] Not showing loader on add bank account page Jan 20, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jan 20, 2023

Job added to Upwork: https://www.upwork.com/jobs/~017a4fe2b93e051102

@melvin-bot
Copy link

melvin-bot bot commented Jan 20, 2023

Current assignee @arielgreen is eligible for the External assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented Jan 20, 2023

Triggered auto assignment to Contributor-plus team member for initial proposal review - @eVoloshchak (External)

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jan 20, 2023
@melvin-bot
Copy link

melvin-bot bot commented Jan 20, 2023

Triggered auto assignment to @deetergp (External), see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@abdulrahuman5196
Copy link
Contributor

Proposal
Might be regression from #14264
As we don't check if the token is present or not, we just end up not showing the loader in the UI. We would be required to check if the token is present without any errors to avoid recreating the issue the above PR intended to solve and to solve this loader not showing issue as well.

--- a/src/components/AddPlaidBankAccount.js
+++ b/src/components/AddPlaidBankAccount.js
@@ -115,7 +115,7 @@ class AddPlaidBankAccount extends React.Component {
         if (!plaidBankAccounts.length) {
             return (
                 <FullPageOfflineBlockingView>
-                    {lodashGet(this.props.plaidData, 'isLoading') && (
+                    {(lodashGet(this.props.plaidData, 'isLoading') || (!token && !plaidDataErrorMessage)) && (
                         <View style={[styles.flex1, styles.alignItemsCenter, styles.justifyContentCenter]}>
                             <ActivityIndicator color={themeColors.spinner} size="large" />
                         </View>

We can also use lodash function on the above.

@aimane-chnaif
Copy link
Contributor

We removed !token condition in #14264 in favor of #13236

I think this should be put on HOLD until #13236 is deployed to staging/production. Not reproducible in main.

We can retest after #13236 deployed and close this issue if not reproducible.

cc: @ctkochan22 @nkuoch

@abdulrahuman5196
Copy link
Contributor

abdulrahuman5196 commented Jan 20, 2023

Yup @aimane-chnaif, saw now that #13236 got merged only 3 hours ago. With latest main the issue is not reproducible.

@ctkochan22 ctkochan22 self-assigned this Jan 20, 2023
@ctkochan22
Copy link

This should be fixed with the noted PRs. Can we close?

@Pujan92
Copy link
Contributor

Pujan92 commented Jan 21, 2023

Proposal

Issue: On the read api call OpenPlaidBankLogin we don't set the loading state which seems to be issue here.

Soltuion: We need to update the plaidData isLoading onyx state on the read call OpenPlaidBankLogin which fetches the plaid token.

diff --git a/src/libs/actions/Plaid.js b/src/libs/actions/Plaid.js
index 393b5bbc9..ac463b6d0 100644
--- a/src/libs/actions/Plaid.js
+++ b/src/libs/actions/Plaid.js
@@ -12,7 +12,29 @@ function openPlaidBankLogin(allowDebit, bankAccountID) {
     const params = getPlaidLinkTokenParameters();
     params.allowDebit = allowDebit;
     params.bankAccountID = bankAccountID;
-    API.read('OpenPlaidBankLogin', params);
+    API.read('OpenPlaidBankLogin', params, {
+        optimisticData: [{
+            onyxMethod: CONST.ONYX.METHOD.MERGE,
+            key: ONYXKEYS.PLAID_DATA,
+            value: {
+                isLoading: true,
+            },
+        }],
+        successData: [{
+            onyxMethod: CONST.ONYX.METHOD.MERGE,
+            key: ONYXKEYS.PLAID_DATA,
+            value: {
+                isLoading: false,
+            },
+        }],
+        failureData: [{
+            onyxMethod: CONST.ONYX.METHOD.MERGE,
+            key: ONYXKEYS.PLAID_DATA,
+            value: {
+                isLoading: false,
+            },
+        }],
+    });
 }

Also like other pages(IOUDetails, ...), we can use FullScreenLoadingIndicator instead ActivityIndicator here.

diff --git a/src/components/AddPlaidBankAccount.js b/src/components/AddPlaidBankAccount.js
index 386eea4c3..3a6c9b557 100644
--- a/src/components/AddPlaidBankAccount.js
+++ b/src/components/AddPlaidBankAccount.js
@@ -120,8 +122,8 @@ class AddPlaidBankAccount extends React.Component {
             return (
                 <FullPageOfflineBlockingView>
                     {this.props.plaidData.isLoading && (
-                        <View style={[styles.flex1, styles.alignItemsCenter, styles.justifyContentCenter]}>
-                            <ActivityIndicator color={themeColors.spinner} size="large" />
+                        <View style={[styles.flex1]}>
+                            <FullScreenLoadingIndicator />

Other solution will be w.r.t to onyx key plaidLinkToken which we receives from backend, we need to modify the structure for onyx plaidLinkToken to object from string, which has 2 properties(1 for token, 1 for loading) and the same structure needs to receive from the api response with Merge operation.

@jatinsonijs
Copy link
Contributor

@Pujan92 It is fixed by #13236, plz pull latest code and recheck

@Pujan92
Copy link
Contributor

Pujan92 commented Jan 21, 2023

@jatinsonijs Thanks, I pulled and now it is not reproducible.

@aimane-chnaif @ctkochan22 Isn't it good practice to update the isLoading state on success and failure case, otherwise in the case of failure it keeps spinning and won't show the error.
We are making it to true here with the ONYXKEYS.PLAID_DATA optimisticData.

const optimisticData = [{
onyxMethod: CONST.ONYX.METHOD.SET,
key: ONYXKEYS.PLAID_DATA,
value: {...PlaidDataProps.plaidDataDefaultProps, isLoading: true},
}, {

diff --git a/src/libs/actions/Plaid.js b/src/libs/actions/Plaid.js
index 0785a1fd9..76bbd2e0f 100644
--- a/src/libs/actions/Plaid.js
+++ b/src/libs/actions/Plaid.js
@@ -13,23 +13,42 @@ function openPlaidBankLogin(allowDebit, bankAccountID) {
     const params = getPlaidLinkTokenParameters();
     params.allowDebit = allowDebit;
     params.bankAccountID = bankAccountID;
-    const optimisticData = [{
-        onyxMethod: CONST.ONYX.METHOD.SET,
-        key: ONYXKEYS.PLAID_DATA,
-        value: {...PlaidDataProps.plaidDataDefaultProps, isLoading: true},
-    }, {
-        onyxMethod: CONST.ONYX.METHOD.SET,
-        key: ONYXKEYS.PLAID_LINK_TOKEN,
-        value: '',
-    }, {
-        onyxMethod: CONST.ONYX.METHOD.MERGE,
-        key: ONYXKEYS.REIMBURSEMENT_ACCOUNT_DRAFT,
-        value: {
-            plaidAccountID: '',
-        },
-    }];
 
-    API.read('OpenPlaidBankLogin', params, {optimisticData});
+    API.read('OpenPlaidBankLogin', params, {
+        optimisticData: [
+            {
+                onyxMethod: CONST.ONYX.METHOD.SET,
+                key: ONYXKEYS.PLAID_DATA,
+                value: {...PlaidDataProps.plaidDataDefaultProps, isLoading: true},
+            },
+        ],
+        successData: [
+            {
+                onyxMethod: CONST.ONYX.METHOD.MERGE,
+                key: ONYXKEYS.PLAID_LINK_TOKEN,
+                value: '',
+            },
+            {
+                onyxMethod: CONST.ONYX.METHOD.MERGE,
+                key: ONYXKEYS.PLAID_DATA,
+                value: {...PlaidDataProps.plaidDataDefaultProps},
+            },
+        ],
+        failureData: [
+            {
+                onyxMethod: CONST.ONYX.METHOD.MERGE,
+                key: ONYXKEYS.REIMBURSEMENT_ACCOUNT_DRAFT,
+                value: {
+                    plaidAccountID: '',
+                },
+            },
+            {
+                onyxMethod: CONST.ONYX.METHOD.MERGE,
+                key: ONYXKEYS.PLAID_DATA,
+                value: {...PlaidDataProps.plaidDataDefaultProps, errors: {['Error Message']}},
+            },
+        ],
+    });
 }

Issue with the hardcoded change for demo which restricts plaid redirection as added && false within PlaidLink

Screen.Recording.2023-01-21.at.2.36.08.PM.mp4

@melvin-bot melvin-bot bot added the Overdue label Jan 23, 2023
@eVoloshchak
Copy link
Contributor

Not overdue, seems like the issue has been fixed by #13236, since it isn't reproducible anymore.

@melvin-bot melvin-bot bot removed the Overdue label Jan 23, 2023
@arielgreen
Copy link
Contributor

Closing since this is now resolved.

@Pujan92
Copy link
Contributor

Pujan92 commented Jan 24, 2023

@eVoloshchak @ctkochan22 Can you plz check my comment as it says loader keeps on showing in case of the error.

@eVoloshchak
Copy link
Contributor

eVoloshchak commented Jan 24, 2023

@Pujan92, I've seen it, I think this is something worth reporting on Slack. It's different from our issue, since in your case spinner will be showing when it shouldn't

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors
Projects
None yet
Development

No branches or pull requests

9 participants