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

Update proptypes for participant.icons in IOU components #15464

Merged
merged 2 commits into from
Feb 28, 2023

Conversation

ctkochan22
Copy link
Contributor

@ctkochan22 ctkochan22 commented Feb 23, 2023

@grgia

Details

SVG's are functions! So getAvatar can either return a string or a function. Update the proptypes for child components to reflect that.

Fixed Issues

$ #15369

Tests / QA Steps

We don't log the incorrect proptype error the second time it seems, so make sure you refresh before each test try

  1. Log into an account that has a gold wallet
  2. Press the "+" icon, and select either send or request money
  3. Select any amount
  4. Select someone ( that does not have an image set, so their avatar is a default avatar )
  5. Verify that there are no console errors indicating an unexpected proptype

You do not want to see something like this:
image

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

https://recordit.co/2KifMfObN1

Mobile Web - Chrome

https://recordit.co/PluJXfE56C

Mobile Web - Safari

https://recordit.co/BABUlVNhNM

Desktop

https://recordit.co/JXbh3hx7xD

iOS

https://recordit.co/VH3qPipZ1g

Android

https://recordit.co/U74btyod9C

@ctkochan22 ctkochan22 requested a review from a team as a code owner February 23, 2023 23:45
@ctkochan22 ctkochan22 self-assigned this Feb 23, 2023
@ctkochan22
Copy link
Contributor Author

Adding screenshots

@melvin-bot melvin-bot bot requested review from Julesssss and sobitneupane and removed request for a team February 23, 2023 23:46
@MelvinBot
Copy link

@sobitneupane @Julesssss 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]

Copy link
Contributor

@sobitneupane sobitneupane left a comment

Choose a reason for hiding this comment

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

@ctkochan22 We might want to update prop-types in following cases as well.

icons: PropTypes.arrayOf(PropTypes.string),

icons: PropTypes.arrayOf(PropTypes.string),

icons: PropTypes.arrayOf(PropTypes.string),

Copy link
Contributor

@grgia grgia left a comment

Choose a reason for hiding this comment

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

I agree with the above comment, but otherwise looks good! Also I'd note, imported SVGs are functions! 😁

@ctkochan22
Copy link
Contributor Author

@grgia Could you take over this PR? I have to unassign

@ctkochan22 ctkochan22 assigned grgia and unassigned ctkochan22 Feb 27, 2023
@grgia
Copy link
Contributor

grgia commented Feb 27, 2023

@ctkochan22 no problem!

Copy link
Contributor

@sobitneupane sobitneupane left a comment

Choose a reason for hiding this comment

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

Screenshots/Videos

Web
Screen.Recording.2023-02-28.at.13.54.31.mov
Mobile Web - Chrome
Screen.Recording.2023-02-28.at.14.05.04.mov
Mobile Web - Safari
Screen.Recording.2023-02-28.at.14.03.23.mov
Desktop
Screen.Recording.2023-02-28.at.14.01.08.mov
iOS
Screen.Recording.2023-02-28.at.14.06.50.mov
Android
Screen.Recording.2023-02-28.at.14.12.01.mov

Copy link
Contributor

@sobitneupane sobitneupane left a comment

Choose a reason for hiding this comment

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

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.

Copy link
Contributor

@Julesssss Julesssss left a comment

Choose a reason for hiding this comment

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

Test passed after a retry

@Julesssss Julesssss merged commit 74ffbb6 into main Feb 28, 2023
@Julesssss Julesssss deleted the ckt_icon_propTypeError branch February 28, 2023 11:59
@github-actions
Copy link
Contributor

Performance Comparison Report 📊

Significant Changes To Duration

Name Duration
Open Search Page TTI 616.062 ms → 676.608 ms (+60.546 ms, +9.8%) 🔴
Show details
Name Duration
Open Search Page TTI Baseline
Mean: 616.062 ms
Stdev: 17.160 ms (2.8%)
Runs: 585.2187510002404 586.8337399996817 590.4336350001395 590.4483230002224 590.9242359995842 598.5757250003517 598.7078860001639 604.0510260006413 606.865275000222 608.5386560000479 610.250447999686 612.1618659999222 612.3760580001399 613.1707760002464 614.1672769999132 616.162434999831 617.8598629999906 618.175741000101 622.09375 622.5806480003521 624.4143469994888 624.9154460001737 625.3295499999076 627.1914069997147 627.581664999947 629.037597999908 629.2405190002173 629.4331870004535 631.2586270002648 639.040853000246 648.5659590000287 658.3919679997489

Current
Mean: 676.608 ms
Stdev: 22.156 ms (3.3%)
Runs: 635.4344070004299 637.4511310001835 638.4744060002267 641.6262619998306 643.1004229998216 657.7419429998845 658.8893240001053 661.0657150000334 665.7812100006267 667.3542889999226 668.7488200003281 669.8566900007427 671.4554859995842 672.2882899995893 674.1330570001155 678.3845220003277 683.2965500000864 683.4845390003175 684.3734949994832 684.841146000661 687.5465500000864 687.7844240004197 689.6737069999799 689.9153240006417 691.243693000637 691.365764000453 692.0146900005639 695.5836189994588 698.9028320005164 703.412313000299 719.997192999348 726.2344979997724

Meaningless Changes To Duration

Show entries
Name Duration
App start TTI 733.083 ms → 741.590 ms (+8.507 ms, +1.2%)
App start regularAppStart 0.015 ms → 0.015 ms (+0.000 ms, +3.0%)
App start nativeLaunch 20.594 ms → 19.900 ms (-0.694 ms, -3.4%)
App start runJsBundle 204.063 ms → 202.774 ms (-1.288 ms, -0.6%)
Show details
Name Duration
App start TTI Baseline
Mean: 733.083 ms
Stdev: 25.335 ms (3.5%)
Runs: 675.760821999982 677.072100000456 695.7865249998868 706.061555000022 708.4574440000579 708.6658190004528 708.798193000257 715.0566530004144 715.9024189999327 719.1522829998285 719.2993799997494 725.886598999612 728.0154659999534 731.2576599996537 731.819010999985 733.4177200002596 734.0281849997118 739.2198409996927 742.5621020002291 743.187839999795 745.0527370003983 745.0891899997368 747.4047860000283 750.755082000047 750.9442189997062 759.6155080003664 761.4558349996805 763.2312489999458 763.4622160000727 764.3405950004235 766.6955150002614 781.1982460003346

Current
Mean: 741.590 ms
Stdev: 29.201 ms (3.9%)
Runs: 684.1363260000944 702.500989000313 702.5096950000152 704.113346000202 704.7656399998814 707.0997729999945 709.0011050002649 717.0638589998707 717.9876150004566 722.4179050000384 727.8805280001834 728.1017880002037 733.1570610003546 735.3248330000788 740.4069199999794 743.9984039999545 745.0189290000126 745.0963190002367 754.6089890003204 758.9076049998403 758.948269999586 761.1611280003563 763.1161399995908 764.7176540000364 766.7617319999263 769.3535890001804 772.3045749999583 782.1222369996831 782.3464350001886 784.9254200002179 799.4317709999159
App start regularAppStart Baseline
Mean: 0.015 ms
Stdev: 0.001 ms (8.6%)
Runs: 0.013020999729633331 0.013427999801933765 0.013590000569820404 0.013590999878942966 0.013671999797224998 0.01375299971550703 0.013875000178813934 0.013996999710798264 0.014078999869525433 0.01411999948322773 0.014161000028252602 0.014322999864816666 0.014526999555528164 0.014566999860107899 0.014566999860107899 0.014771000482141972 0.014810999855399132 0.014932999387383461 0.014932999387383461 0.015054999850690365 0.015095999464392662 0.015137000009417534 0.01550300046801567 0.015786999836564064 0.0159919997677207 0.0161530002951622 0.016439000144600868 0.01660200022161007 0.017171000130474567 0.017171000130474567 0.01753699965775013 0.01822999957948923

Current
Mean: 0.015 ms
Stdev: 0.001 ms (5.3%)
Runs: 0.013632000423967838 0.014201000332832336 0.014444999396800995 0.014485999941825867 0.0147299999371171 0.014771000482141972 0.014771000482141972 0.0148930000141263 0.014933000318706036 0.014973999932408333 0.015056000091135502 0.015056000091135502 0.015137000009417534 0.015178000554442406 0.015381000004708767 0.015421999618411064 0.015584000386297703 0.01566499937325716 0.015665999613702297 0.015705999918282032 0.015706999227404594 0.015949999913573265 0.015990999527275562 0.016032000072300434 0.016032000072300434 0.016276000067591667 0.016521000303328037 0.016560999676585197 0.016561000607907772 0.017009000293910503 0.017211999744176865
App start nativeLaunch Baseline
Mean: 20.594 ms
Stdev: 2.935 ms (14.3%)
Runs: 17 17 17 17 18 18 18 18 18 18 19 19 19 19 20 20 20 20 20 21 21 21 22 22 24 24 24 24 25 25 27 27

Current
Mean: 19.900 ms
Stdev: 2.022 ms (10.2%)
Runs: 18 18 18 18 18 18 18 18 19 19 19 19 19 19 19 19 20 20 20 20 20 20 20 21 22 22 22 23 25 26
App start runJsBundle Baseline
Mean: 204.063 ms
Stdev: 18.780 ms (9.2%)
Runs: 169 174 175 182 182 184 184 191 191 191 194 196 201 202 202 203 203 205 208 210 212 213 213 218 218 218 221 225 228 237 238 242

Current
Mean: 202.774 ms
Stdev: 15.694 ms (7.7%)
Runs: 173 180 180 184 186 190 191 191 193 195 196 196 197 197 197 199 202 203 205 207 209 212 213 215 215 216 221 224 230 232 237

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

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

@Julesssss
Copy link
Contributor

Julesssss commented Feb 28, 2023

If it wasn't for this line I would find it hard to believe this prop-type change could cause a 9.8% performance regression. We render a lot of avatars on the Report page, but is it possible that simply changing the type could cause this??

Also, does anyone know if it's possible to re-run the check?

@OSBotify
Copy link
Contributor

OSBotify commented Mar 2, 2023

🚀 Deployed to staging by https://github.com/Julesssss in version: 1.2.78-0 🚀

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

@mvtglobally
Copy link

@ctkochan22 @grgia @Julesssss How can we have a gold wallet? Do you know whats the process to enable it?

@Julesssss
Copy link
Contributor

Hey @mvtglobally, AFAIK gold wallets aren't available to non-US people yet, so unfortunately I can't help. But we'll need an internal US employee to test I think.

@OSBotify
Copy link
Contributor

OSBotify commented Mar 6, 2023

🚀 Deployed to production by https://github.com/mountiny in version: 1.2.78-0 🚀

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.

7 participants