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

Add reimbursementpage loader right away #14619

Merged
merged 2 commits into from
Jan 27, 2023
Merged

Add reimbursementpage loader right away #14619

merged 2 commits into from
Jan 27, 2023

Conversation

nkuoch
Copy link
Contributor

@nkuoch nkuoch commented Jan 27, 2023

Details

Loader didn't happen right away when opening the page, which resulted in being able to click the Plaid button when we shouldn't, resulting in the plaid modal not opening.

Fixed Issues

$ #14583

Tests

Create a workspace and quickly click on Connect Bank Account. Make sure you see the loader.
As soon as you see the Connect Online With Plaid button, click on it.
Make sure it opens the Plaid modal.

Offline tests

N/A

QA Steps

Create a workspace and quickly click on Connect Bank Account. Make sure you see the loader.
As soon as you see the Connect Online With Plaid button, click on it.
Make sure it opens the Plaid modal.

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android / native
    • Android / Chrome
    • iOS / native
    • iOS / Safari
    • MacOS / Chrome / Safari
    • MacOS / Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I verified the translation was requested/reviewed in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is correct English and approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I have checked off every checkbox in the PR author checklist, including those that don't apply to this PR.

Screenshots/Videos

Web
2023-01-27_12-59-27.mp4
Mobile Web - Chrome
Mobile Web - Safari
Desktop
2023-01-27_13-12-39.mp4
iOS
Android

@nkuoch nkuoch requested a review from a team as a code owner January 27, 2023 12:00
@nkuoch nkuoch self-assigned this Jan 27, 2023
@melvin-bot melvin-bot bot requested review from 0xmiros and Luke9389 and removed request for a team January 27, 2023 12:01
@melvin-bot
Copy link

melvin-bot bot commented Jan 27, 2023

@0xmiroslav @Luke9389 One of you needs to copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@@ -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});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/**
* Set the reimbursement account loading so that it happens right away, instead of when the API command is processed.
*
* @param {Boolean} isLoading
*/
function setReimbursementAccountLoading(isLoading) {
Onyx.merge(ONYXKEYS.REIMBURSEMENT_ACCOUNT, {isLoading});
}

@nkuoch how about using common function above? This was already used in Reimburse expenses page.

// Instead of setting the reimbursement account loading within the optimistic data of the API command, use a separate action so that the Onyx value is updated right away.
// openWorkspaceReimburseView uses API.read which will not make the request until all WRITE requests in the sequential queue have finished responding, so there would be a delay in
// updating Onyx with the optimistic data.
BankAccounts.setReimbursementAccountLoading(true);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah nice

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you need to move setReimbursementAccountLoading above openReimbursementAccountPage to avoid lint error.

@0xmiros
Copy link
Contributor

0xmiros commented Jan 27, 2023

Reviewer Checklist

  • I have verified the author checklist is complete (all boxes are checked off).
  • I verified the correct issue is linked in the ### Fixed Issues section above
  • I verified testing steps are clear and they cover the changes made in this PR
    • I verified the steps for local testing are in the Tests section
    • I verified the steps for Staging and/or Production testing are in the QA steps section
    • I verified the steps cover any possible failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
  • I checked that screenshots or videos are included for tests on all platforms
  • I included screenshots or videos for tests on all platforms
  • I verified tests pass on all platforms & I tested again on:
    • Android / native
    • Android / Chrome
    • iOS / native
    • iOS / Safari
    • MacOS / Chrome / Safari
    • MacOS / Desktop
  • If there are any errors in the console that are unrelated to this PR, I either fixed them (preferred) or linked to where I reported them in Slack
  • I verified proper code patterns were followed (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick).
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is correct English and approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I verified that this PR follows the guidelines as stated in the Review Guidelines
  • I verified other components that can be impacted by these changes have been tested, and I retested again (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar have been tested & I retested again)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Web
web.mov
Mobile Web - Chrome
mchrome.mp4
Mobile Web - Safari
mweb.mp4
Desktop
desktop.mov
iOS
ios.mp4
Android
android.mp4

Copy link
Contributor

@Luke9389 Luke9389 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, good call

@Luke9389 Luke9389 merged commit 36225e3 into main Jan 27, 2023
@Luke9389 Luke9389 deleted the nat-load branch January 27, 2023 21:36
@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@github-actions
Copy link
Contributor

Performance Comparison Report 📊

Significant Changes To Duration

There are no entries

Meaningless Changes To Duration

Show entries
Name Duration
App start TTI 696.753 ms → 710.267 ms (+13.514 ms, +1.9%)
Open Search Page TTI 609.701 ms → 614.028 ms (+4.326 ms, +0.7%)
App start nativeLaunch 19.935 ms → 20.313 ms (+0.377 ms, +1.9%)
App start regularAppStart 0.017 ms → 0.015 ms (-0.002 ms, -10.2%)
App start runJsBundle 194.625 ms → 191.452 ms (-3.173 ms, -1.6%)
Show details
Name Duration
App start TTI Baseline
Mean: 696.753 ms
Stdev: 35.433 ms (5.1%)
Runs: 601.0287290001288 638.013756999746 655.1930860001594 657.4099190002307 657.8675939999521 668.626052999869 668.9419240001589 670.2205430008471 675.5212660003453 675.5534569993615 676.5188960004598 686.1619999995455 686.1664209999144 688.3169120000675 691.2507109995931 693.8218419998884 694.5921679995954 696.5255349995568 702.9377899998799 703.2839160002768 709.9485359992832 718.6339600002393 728.0403150003403 730.2543880008161 731.0834010001272 731.2879719994962 731.7253970000893 735.6634580008686 736.2000750005245 742.5427339999005 747.6698780003935 765.0822049994022

Current
Mean: 710.267 ms
Stdev: 37.463 ms (5.3%)
Runs: 643.4810210000724 668.5542879998684 671.0088890008628 674.0893600005656 675.3875479996204 675.5189299993217 675.9135800004005 676.3088310007006 678.3662630002946 680.9343159999698 689.558796999976 690.4205140005797 693.6220059990883 697.1491500008851 697.7872700002044 703.2262510005385 705.2889060005546 709.5069459993392 710.8863060008734 718.707383999601 719.658402999863 722.9374310001731 726.6916220001876 734.4179320000112 736.2886699996889 737.108178999275 743.5549749992788 748.6586579997092 753.0013440009207 759.259733999148 796.7855949997902 814.4655460007489
Open Search Page TTI Baseline
Mean: 609.701 ms
Stdev: 12.749 ms (2.1%)
Runs: 581.3420010004193 584.0175790004432 587.5503339990973 595.4354250002652 597.0395919997245 597.6824140008539 598.6133219990879 602.819499000907 604.2588300015777 605.8861899990588 606.1852619983256 606.7577309999615 608.8896890003234 609.2432049997151 609.5443120002747 610.2456459999084 610.3024090006948 610.6123859994113 610.6461190003902 611.4248859994113 613.1772060003132 617.2106929998845 617.9633800014853 618.109822999686 618.2290039993823 622.2906909994781 626.3033849988133 626.6721609998494 629.875813998282 631.079264998436 631.3288979995996

Current
Mean: 614.028 ms
Stdev: 19.676 ms (3.2%)
Runs: 582.5365399997681 587.5121660009027 591.2119140010327 593.1968179997057 593.3267419990152 595.3212490007281 596.7477209996432 597.0309250000864 598.6378170009702 598.9320480003953 599.9429119993001 602.1186119988561 602.7607009988278 602.9836430009454 604.9420580007136 612.6326909996569 613.6916910000145 614.3321119993925 614.8882650006562 616.4792490005493 618.4813230000436 618.6427410002798 619.5548909995705 624.4733890015632 626.2655849996954 628.1574300006032 629.4182539992034 632.5256759990007 640.4610600005835 643.3941249996424 645.3238929994404 656.1040850002319 660.8822840005159
App start nativeLaunch Baseline
Mean: 19.935 ms
Stdev: 1.605 ms (8.1%)
Runs: 17 17 18 18 18 19 19 19 19 19 19 19 19 20 20 20 20 20 20 20 20 21 21 21 21 21 22 22 22 23 24

Current
Mean: 20.313 ms
Stdev: 2.721 ms (13.4%)
Runs: 17 17 18 18 18 18 18 18 18 18 19 19 19 19 19 19 19 19 19 20 21 21 22 22 22 23 23 25 25 25 25 27
App start regularAppStart Baseline
Mean: 0.017 ms
Stdev: 0.001 ms (7.5%)
Runs: 0.015137000009417534 0.015584000386297703 0.015665000304579735 0.015705999918282032 0.015869000926613808 0.01590999960899353 0.0159919997677207 0.016071999445557594 0.01619499921798706 0.016316000372171402 0.016397999599575996 0.016519999131560326 0.016682999208569527 0.016683001071214676 0.016927000135183334 0.016968000680208206 0.017048999667167664 0.017211999744176865 0.017252999357879162 0.017333999276161194 0.017782000824809074 0.0179449999704957 0.01798499934375286 0.018147999420762062 0.018188999965786934 0.01839200034737587 0.0185139998793602 0.01928700041025877 0.0195720000192523 0.020589999854564667

Current
Mean: 0.015 ms
Stdev: 0.001 ms (5.0%)
Runs: 0.013876000419259071 0.013916000723838806 0.013956001028418541 0.013957001268863678 0.014485999941825867 0.014689000323414803 0.014770999550819397 0.014851998537778854 0.014892000705003738 0.015015000477433205 0.015217998996376991 0.015259001404047012 0.015259001404047012 0.015300000086426735 0.015380000695586205 0.015461999922990799 0.01550300046801567 0.015543999150395393 0.015584001317620277 0.015625 0.015625 0.015828998759388924 0.015829000622034073 0.015951000154018402 0.01603199914097786 0.01607299968600273 0.016154000535607338 0.016235999763011932 0.016276000067591667 0.016356999054551125 0.01647999882698059 0.016641998663544655
App start runJsBundle Baseline
Mean: 194.625 ms
Stdev: 19.279 ms (9.9%)
Runs: 154 167 169 170 174 178 179 180 181 184 185 187 187 188 191 192 195 195 197 197 201 201 205 206 209 211 211 217 221 228 233 235

Current
Mean: 191.452 ms
Stdev: 16.890 ms (8.8%)
Runs: 164 168 170 172 173 173 174 175 176 181 185 186 187 191 191 191 191 192 195 195 199 200 200 201 201 206 210 210 218 227 233

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by https://github.com/Luke9389 in version: 1.2.62-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@OSBotify
Copy link
Contributor

🚀 Deployed to production by https://github.com/thienlnam in version: 1.2.62-1 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants