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

fix image attachment infinite loading #15472

Merged
merged 1 commit into from
Feb 24, 2023
Merged

Conversation

bernhardoj
Copy link
Contributor

Details

Sometimes we are experiencing infinite image loading on Android only.

Fixed Issues

$ #15288
PROPOSAL: #15288 (comment)

Tests

Same as QA Steps

  • Verify that no errors appear in the JS console

Offline tests

Same as QA Steps

QA Steps

  1. Open any chat
  2. Send an image of any type
  3. Open the image you just sent
  4. Verify the image loaded and shown successfully
  5. Close the image modal
  6. Repeat step 3-5 multiple times
  • 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
Screen.Recording.2023-02-23.at.19.05.49.mov
Mobile Web - Chrome
331031.t.mp4
Mobile Web - Safari
Screen.Recording.2023-02-23.at.20.17.35.mov
Desktop
Screen.Recording.2023-02-23.at.19.14.36.mov
iOS
Screen.Recording.2023-02-23.at.19.56.50.mov
Android
331030.t.mp4

@bernhardoj bernhardoj requested a review from a team as a code owner February 24, 2023 04:24
@melvin-bot melvin-bot bot requested review from bondydaa and s77rt and removed request for a team February 24, 2023 04:24
@MelvinBot
Copy link

@bondydaa @s77rt 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]

@s77rt
Copy link
Contributor

s77rt commented Feb 24, 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.
  • 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
web.mp4
Mobile Web - Chrome
mweb-chrome.mp4
Mobile Web - Safari
mweb-safari.mp4
Desktop
desktop.mp4
iOS
ios.mp4
Android
android.mp4

@s77rt
Copy link
Contributor

s77rt commented Feb 24, 2023

@bernhardoj Thanks for the quick PR!

LGTM and tests well!

@bondydaa All yours

Copy link
Contributor

@bondydaa bondydaa left a comment

Choose a reason for hiding this comment

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

code looks good, testing it now and will approve once I'm done.

Copy link
Contributor

@bondydaa bondydaa left a comment

Choose a reason for hiding this comment

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

seems to work great to me! nice work 🤙

@bondydaa bondydaa merged commit 7494f83 into Expensify:main Feb 24, 2023
@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

Name Duration
Open Search Page TTI 602.295 ms → 664.182 ms (+61.887 ms, +10.3%) 🔴
Show details
Name Duration
Open Search Page TTI Baseline
Mean: 602.295 ms
Stdev: 23.467 ms (3.9%)
Runs: 570.0844330000691 570.354656000156 574.4385169998277 576.315673999954 578.6101899999194 580.6865650000982 581.7682700001169 582.9662280001212 587.6317549999803 588.3987230001949 588.8601079999935 589.066000000108 591.6624350000639 592.3470860000234 594.1592200000305 594.7436120000202 595.7554929999169 596.0382080001291 597.6530769998208 599.4412839999422 607.065510999877 608.9612219999544 619.6938070000615 619.8968509999104 625.474324000068 626.0455330000259 629.0317379999906 630.3267010001 632.307739000069 632.8382979999296 642.6671959999949 668.1388759999536

Current
Mean: 664.182 ms
Stdev: 21.748 ms (3.3%)
Runs: 623.7651780000888 625.284587000031 632.5655930000357 637.7237140000798 639.2571620000526 649.9962159995921 652.98799699964 653.376139999833 654.4294030000456 654.5449220002629 655.5684820003808 656.9650480002165 657.1786299999803 659.3553470000625 659.8394780000672 661.1820880002342 663.2013759999536 663.5683190003037 664.0861420002766 664.1875 664.4666349999607 665.5171310002916 673.7733160001226 684.7003990001976 685.3843179997057 689.0489099998958 689.6617439999245 690.7064220001921 699.1650399998762 700.5305990003981 717.6208089999855

Meaningless Changes To Duration

Show entries
Name Duration
App start TTI 689.773 ms → 706.843 ms (+17.070 ms, +2.5%)
App start runJsBundle 183.857 ms → 193.750 ms (+9.893 ms, +5.4%)
App start regularAppStart 0.013 ms → 0.017 ms (+0.003 ms, +26.6%) 🟡
App start nativeLaunch 21.267 ms → 20.800 ms (-0.467 ms, -2.2%)
Show details
Name Duration
App start TTI Baseline
Mean: 689.773 ms
Stdev: 20.996 ms (3.0%)
Runs: 649.8844880000688 653.2014289998915 662.4474289999343 664.0267970000859 666.7794780000113 666.8081569999922 667.2275590000208 669.1344759999774 673.2683449999895 673.9941650000401 682.1935690001119 686.8350100000389 687.7373500000685 688.8716219998896 689.061362999957 690.3037920000497 693.7635240000673 694.7551430000458 694.7768530000467 698.8883070000447 701.031742000021 701.4590060000774 702.6326369999442 703.2432959999423 704.8391430000775 706.8251920000184 708.0802800001111 718.6861219999846 723.6385530000553 725.5524420000147 733.0040579999331

Current
Mean: 706.843 ms
Stdev: 21.174 ms (3.0%)
Runs: 670.804320000112 675.089302000124 675.5388250001706 678.8707240000367 679.5368860000744 680.7667430001311 682.3840780002065 692.9327500001527 696.469250000082 697.3337909998372 701.4717939998955 703.7938659999054 704.9979739999399 706.8968340000138 707.2456720001064 708.7317339999136 709.7792160001118 710.4402760001831 715.2588880001567 717.1732299998403 722.2751079997979 722.8029600000009 723.9526269999333 729.1731110000983 730.2551150000654 731.1137749999762 732.0766150001436 735.5381680000573 755.742546999827
App start runJsBundle Baseline
Mean: 183.857 ms
Stdev: 11.569 ms (6.3%)
Runs: 162 166 168 173 173 173 175 176 177 178 178 179 181 183 184 185 188 188 190 190 191 192 192 194 194 199 207 212

Current
Mean: 193.750 ms
Stdev: 18.109 ms (9.3%)
Runs: 167 167 168 171 172 174 178 180 183 183 185 186 188 188 189 190 191 194 197 197 197 201 205 208 208 208 211 212 212 218 227 245
App start regularAppStart Baseline
Mean: 0.013 ms
Stdev: 0.001 ms (6.1%)
Runs: 0.011758999899029732 0.01204399997368455 0.01204399997368455 0.012124999891966581 0.012247000122442842 0.012329000048339367 0.012492000125348568 0.012614000122994184 0.012654999969527125 0.012695000041276217 0.01269600004889071 0.012735999887809157 0.012736000120639801 0.012857999885454774 0.0129399998113513 0.012980000115931034 0.012980000115931034 0.01310200011357665 0.013142999960109591 0.013184000039473176 0.01322500011883676 0.013264999957755208 0.0133050000295043 0.013467999873682857 0.013590999878942966 0.013835000107064843 0.01407799986191094 0.014200999867171049 0.014364000177010894 0.014526000013574958 0.014811000088229775 0.0148930000141263

Current
Mean: 0.017 ms
Stdev: 0.001 ms (5.0%)
Runs: 0.015055000316351652 0.015056000091135502 0.01513600000180304 0.015339999925345182 0.015869999770075083 0.016031999606639147 0.01611300022341311 0.016195000149309635 0.016276000067591667 0.0163569999858737 0.016358000226318836 0.016397999599575996 0.0165200000628829 0.0165200000628829 0.016600999981164932 0.016600999981164932 0.01660200022161007 0.016844999976456165 0.016845999751240015 0.01688600005581975 0.016926999669522047 0.01696800021454692 0.017008000053465366 0.017089999746531248 0.017293000128120184 0.017496000044047832 0.017740999814122915 0.017740999814122915 0.018148000352084637 0.018391999881714582
App start nativeLaunch Baseline
Mean: 21.267 ms
Stdev: 2.476 ms (11.6%)
Runs: 18 19 19 19 19 19 19 19 20 20 20 20 20 20 20 20 21 21 21 21 22 23 23 23 23 24 25 26 26 28

Current
Mean: 20.800 ms
Stdev: 1.641 ms (7.9%)
Runs: 18 19 19 19 19 19 19 19 19 20 20 20 20 21 21 21 21 21 21 21 22 22 22 22 22 22 23 24 24 24

@github-actions github-actions bot added the DeployBlockerCash This issue or pull request should block deployment label Feb 24, 2023
@github-actions
Copy link
Contributor

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

@s77rt
Copy link
Contributor

s77rt commented Feb 24, 2023

I think the performance reported problem is a false positive, this PR has nothing to do with the search page.

@s77rt
Copy link
Contributor

s77rt commented Feb 24, 2023

cc @bondydaa to confirm ^

@bondydaa
Copy link
Contributor

yeah most likely, I've never had this happen before so wonder if we can re-trigger the performance comparison? going to ask in slack.

@s77rt
Copy link
Contributor

s77rt commented Feb 24, 2023

Noticed this here too

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by https://github.com/bondydaa in version: 1.2.77-0 🚀

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

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by https://github.com/bondydaa in version: 1.2.77-0 🚀

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

@OSBotify
Copy link
Contributor

OSBotify commented Mar 2, 2023

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

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

@mananjadhav
Copy link
Collaborator

I am tagging this PR to highlight an issue fixed here. All conditions in ternary expressions or left-hand operands on conditional renders, should be boolean. This PR is one of the PRs that uses conditional render with string operands, hence I am tagging it here for the contributors to check.

We've also updated the item in the checklist with this PR to avoid this issues in the future.

@s77rt
Copy link
Contributor

s77rt commented Apr 27, 2023

@mananjadhav I think this is a false positive 😅. this.state.containerHeight is a number not a string, but yet not a boolean either 😁. Thanks for the info though!

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.

6 participants