Skip to content

reset drawerIsReady promise when BaseDrawerNavigator unmounts#15500

Merged
yuwenmemon merged 2 commits into
Expensify:mainfrom
ntdiary:fix-issue-14177
Feb 27, 2023
Merged

reset drawerIsReady promise when BaseDrawerNavigator unmounts#15500
yuwenmemon merged 2 commits into
Expensify:mainfrom
ntdiary:fix-issue-14177

Conversation

@ntdiary

@ntdiary ntdiary commented Feb 25, 2023

Copy link
Copy Markdown
Contributor

Details

Fixed Issues

$ #14177
PROPOSAL: #14177 (comment)

Tests

  1. Log in NewDot with an account.
  2. Open a new tab, and log in OldDot with a different account that has a existing free workspace.
  3. Go to Settings > Policies > Group.
  4. (Optional) If we can't start OldDot locally, we can open the Chrome developer tools and add a breakpoint in the source panel like the image above.
  5. Click on the free Workspace policy.
  6. (Optional) Execute console.dir(t.replace('https://staging.new.expensify.com', '')) in console to get the /transition... path part, create a new tab and type localhost:8080 and append the transition path part and then open this url.
  7. Verify that there is no endless spinner and you are logged in the same account as in OldDot.
  • Verify that no errors appear in the JS console

Offline tests

N/A (This test needs to be online)

QA Steps

  1. Log in NewDot with an account.
  2. Open a new tab, and log in OldDot with a different account that has a existing free workspace.
  3. Go to Settings > Policies > Group and click on free Workspace policy.
  4. Verify that there is no endless spinner and you are logged in the same account as in OldDot.
  • Verify that no errors appear in the JS console

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.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR author checklist, including those that don't apply to this PR.

Screenshots/Videos

Web
web.mov
Mobile Web - Chrome
android-web.mov
Mobile Web - Safari
ios-web.mov
Desktop Feature not yet implemented in the desktop app.
iOS Feature not yet implemented in the native app.
Android Feature not yet implemented in the native app.

@ntdiary ntdiary marked this pull request as ready for review February 27, 2023 05:02
@ntdiary ntdiary requested a review from a team as a code owner February 27, 2023 05:02
@melvin-bot melvin-bot Bot requested review from thesahindia and yuwenmemon and removed request for a team February 27, 2023 05:02
@MelvinBot

Copy link
Copy Markdown
Contributor

@yuwenmemon @thesahindia 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]

@thesahindia

Copy link
Copy Markdown
Member

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.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

Screenshots/Videos

Web
Screen.Recording.2023-02-27.at.11.03.03.PM.mov
Mobile Web - Chrome
Screen.Recording.2023-02-27.at.11.31.47.PM.mov
Mobile Web - Safari
Screen.Recording.2023-02-27.at.11.18.52.PM.mov
Desktop

N/A

iOS

N/A

Android

N/A

thesahindia
thesahindia previously approved these changes Feb 27, 2023

@thesahindia thesahindia left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good and tests well

cc: @yuwenmemon

@yuwenmemon yuwenmemon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good but I think we could update the comment for the call to resetDrawerIsReadyPromise

}

componentWillUnmount() {
// We need to reset the isDrawerReady promise so that the delay remains in effect when this component is remounted.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What delay exactly? Can we make this more descriptive?


componentWillUnmount() {
// We need to reset the isDrawerReady promise so that the delay remains in effect when this component is remounted.
// For example, navigate from OldDot to NewDot with a different account.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Similarly, this description is a bit vague. "Navigate from OldDot to NewDot with a different account" ...and?

@ntdiary

ntdiary commented Feb 27, 2023

Copy link
Copy Markdown
Contributor Author

Looks good but I think we could update the comment for the call to resetDrawerIsReadyPromise

@yuwenmemon , yeh, how about this new version? 😄

@yuwenmemon yuwenmemon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Much better now, thanks!

@yuwenmemon yuwenmemon merged commit bf8c98f into Expensify:main Feb 27, 2023
@github-actions

Copy link
Copy Markdown
Contributor

Performance Comparison Report 📊

Significant Changes To Duration

Name Duration
Open Search Page TTI 607.747 ms → 663.617 ms (+55.870 ms, +9.2%) 🔴
Show details
Name Duration
Open Search Page TTI Baseline
Mean: 607.747 ms
Stdev: 16.789 ms (2.8%)
Runs: 568.6352539993823 579.2222090000287 585.8046070002019 588.6391610000283 590.1363930003718 592.4792889999226 592.9582519996911 597.390177000314 598.4783939998597 598.9869790002704 599.0969650000334 599.5861820001155 599.5997319994494 603.0884199999273 604.972331000492 607.2939050002024 607.9411630006507 608.5305590005592 609.6640630001202 611.1923020007089 613.427612000145 614.1917730001733 617.816855000332 618.271646999754 623.2262780005112 625.1221920000389 626.019164999947 627.3883869992569 627.7691239994019 633.9785569999367 635.6268309997395 641.3723550001159

Current
Mean: 663.617 ms
Stdev: 22.022 ms (3.3%)
Runs: 621.6076660007238 624.6419270001352 626.8416750002652 627.8629160001874 630.3450929997489 636.08797199931 643.7375889997929 653.2040200000629 653.2384440004826 653.9132899995893 654.5865889992565 655.0864669997245 655.1295170001686 655.2260339995846 662.4241540003568 665.0175379998982 666.5071620000526 666.9581709997728 668.2098799999803 670.0906990002841 673.3576259994879 674.7740080002695 676.6066899998114 677.6658130008727 678.7731929998845 682.7882080003619 683.4613860007375 687.9982500001788 688.9728600000963 692.937826000154 693.0360929993913 693.072835999541 705.1974290004

Meaningless Changes To Duration

Show entries
Name Duration
App start TTI 713.053 ms → 731.253 ms (+18.201 ms, +2.6%)
App start runJsBundle 200.969 ms → 206.250 ms (+5.281 ms, +2.6%)
App start nativeLaunch 19.406 ms → 20.167 ms (+0.760 ms, +3.9%)
App start regularAppStart 0.014 ms → 0.016 ms (+0.003 ms, +20.6%) 🟡
Show details
Name Duration
App start TTI Baseline
Mean: 713.053 ms
Stdev: 37.386 ms (5.2%)
Runs: 648.7731790002435 649.547314000316 650.1618130002171 659.9444610001519 670.7072879998013 671.806528000161 675.890296000056 677.7942690001801 685.6391550004482 693.0882390001789 693.4863700000569 694.640132999979 703.4358719997108 705.98707799986 709.7677929997444 713.1889030002058 719.0919679999352 722.5002800002694 723.7290200004354 726.8366970000789 730.4243879998103 733.0563479997218 741.3713849997148 741.4927880000323 742.518380000256 744.5342140002176 749.0635409997776 749.4075570004061 758.7048730002716 771.7207779996097 776.8842099998146 782.4901329996064

Current
Mean: 731.253 ms
Stdev: 32.071 ms (4.4%)
Runs: 671.1974060004577 682.4991929996759 687.9361159997061 693.866651000455 694.6809059996158 702.7103559998795 704.6580840004608 708.1092499997467 711.1369030000642 713.9025590000674 714.3708030004054 715.8357290001586 718.3412469998002 719.2697270000353 721.4494489999488 723.6821459997445 729.1218400001526 729.7895809998736 735.0852420004085 735.2575279995799 743.0478959996253 744.0595310004428 746.1345610003918 753.6182399997488 758.4518379997462 759.0765079995617 760.092860000208 769.0241550002247 771.8015459999442 780.1075269998983 799.9108969997615 801.8852150002494
App start runJsBundle Baseline
Mean: 200.969 ms
Stdev: 25.075 ms (12.5%)
Runs: 165 166 167 169 169 172 175 178 182 184 185 192 195 195 199 199 199 202 204 205 206 216 218 218 219 220 222 228 228 245 245 264

Current
Mean: 206.250 ms
Stdev: 25.706 ms (12.5%)
Runs: 172 177 179 181 182 183 184 184 185 186 190 190 191 192 194 198 201 201 210 210 214 215 220 222 222 224 231 235 240 250 261 276
App start nativeLaunch Baseline
Mean: 19.406 ms
Stdev: 1.934 ms (10.0%)
Runs: 17 17 18 18 18 18 18 18 18 18 18 18 18 18 18 19 19 19 19 19 20 20 20 20 20 21 21 22 23 23 24 24

Current
Mean: 20.167 ms
Stdev: 2.083 ms (10.3%)
Runs: 18 18 18 18 18 18 18 19 19 19 19 19 19 19 20 20 20 20 20 20 21 21 21 22 22 22 22 24 25 26
App start regularAppStart Baseline
Mean: 0.014 ms
Stdev: 0.001 ms (4.8%)
Runs: 0.012044000439345837 0.012613999657332897 0.012938999570906162 0.012938999570906162 0.0129399998113513 0.012980000115931034 0.013021000660955906 0.01314299926161766 0.013143000192940235 0.013182999566197395 0.013184000737965107 0.013265000656247139 0.013306000269949436 0.013345999643206596 0.013345999643206596 0.013468999415636063 0.013508999720215797 0.013508999720215797 0.013509000651538372 0.013590999878942966 0.013631000183522701 0.013753999955952168 0.013793999329209328 0.0138349998742342 0.013956999406218529 0.014281999319791794 0.014444999396800995 0.014485999941825867 0.014485999941825867 0.014485999941825867 0.014770000241696835 0.014891999773681164

Current
Mean: 0.016 ms
Stdev: 0.001 ms (7.1%)
Runs: 0.014526999555528164 0.014607000164687634 0.014851999469101429 0.014973999932408333 0.015178000554442406 0.015217999927699566 0.015217999927699566 0.015339999459683895 0.015381000004708767 0.015502999536693096 0.01570700015872717 0.01570700015872717 0.01574699953198433 0.015951000154018402 0.016153999604284763 0.016195000149309635 0.016358000226318836 0.016439000144600868 0.01647899951785803 0.016600999981164932 0.016927000135183334 0.016968000680208206 0.017008000053465366 0.017090000212192535 0.017129999585449696 0.017293999902904034 0.017333999276161194 0.01733400020748377 0.018147999420762062 0.018148000352084637 0.018187999725341797 0.01936900056898594

@github-actions github-actions Bot added the DeployBlockerCash This issue or pull request should block deployment label Feb 27, 2023
@github-actions

Copy link
Copy Markdown
Contributor

@Expensify/mobile-deployers 📣 Please look into this performance regression as it's a deploy blocker.

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/yuwenmemon in version: 1.2.77-1 🚀

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

@OSBotify

OSBotify commented Mar 2, 2023

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/yuwenmemon in version: 1.2.77-4 🚀

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

DeployBlockerCash This issue or pull request should block deployment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants