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/14254: Member count is not updated #14596

Merged
merged 4 commits into from
Jan 30, 2023

Conversation

tienifr
Copy link
Contributor

@tienifr tienifr commented Jan 26, 2023

Details

Member Count in detail chat is not updated immediately because the menu items are created in the constructor, it will not updated when this.props.report is changed. This PR will fix it by creating the getMenuItems function and calling it in render()

Fixed Issues

$ #14254
$ #14254 (comment)

Tests

  1. Create a workspace by userA
  2. Add userB as member
  3. For userB, go to #announce > details > members
  4. For userA, add a new member to the workspace
  5. New member will be shown in the members list for userB , go back to details page and check the members count
  • Verify that no errors appear in the JS console

Offline tests

QA Steps

  1. Create a workspace by userA
  2. Add userB as member
  3. For userB, go to #announce > details > members
  4. For userA, add a new member to the workspace
  5. New member will be shown in the members list for userB , go back to details page and check the members count
  6. Verify that the member count is updated immediately
  • 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.
  • 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-01-26.at.22.51.38.mp4
Mobile Web - Chrome
Screen.Recording.2023-01-26.at.23.12.08.mp4
Mobile Web - Safari
Screen.Recording.2023-01-26.at.22.59.04.mp4
Desktop
Screen.Recording.2023-01-26.at.23.14.19.mp4
iOS
Screen.Recording.2023-01-26.at.23.27.45.mp4
Android
android.mp4

@tienifr tienifr requested a review from a team as a code owner January 26, 2023 16:32
@melvin-bot melvin-bot bot requested review from flodnv and parasharrajat and removed request for a team January 26, 2023 16:32
@melvin-bot
Copy link

melvin-bot bot commented Jan 26, 2023

@flodnv @parasharrajat 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]

src/pages/ReportDetailsPage.js Outdated Show resolved Hide resolved
Comment on lines -57 to -58
constructor(props) {
super(props);
Copy link
Member

Choose a reason for hiding this comment

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

constructor is compulsory for class components.

Copy link
Contributor

Choose a reason for hiding this comment

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

What happened with this comment? If it is compulsory then why are we removing it?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh I see it here: #14596 (comment)

tienifr and others added 2 commits January 27, 2023 22:23
Co-authored-by: Rajat Parashar <parasharrajat@users.noreply.github.com>
@tienifr
Copy link
Contributor Author

tienifr commented Jan 27, 2023

Thanks @parasharrajat Please help to check again

src/pages/ReportDetailsPage.js Outdated Show resolved Hide resolved
Copy link
Member

@parasharrajat parasharrajat left a comment

Choose a reason for hiding this comment

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

Testing

@parasharrajat
Copy link
Member

parasharrajat commented Jan 30, 2023

Screenshots

🔲 iOS / native

screen-2023-01-30_22.28.14.mp4

🔲 iOS / Safari

screen-2023-01-30_22.15.20.mp4

🔲 MacOS / Desktop

screen-2023-01-30_22.23.49.mp4

🔲 MacOS / Chrome

screen-2023-01-30_21.18.55.mp4

🔲 Android / Chrome

screen-2023-01-30_21.22.45.mp4

🔲 Android / native

screen-2023-01-30_21.29.02.mp4

Copy link
Member

@parasharrajat parasharrajat 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.
  • I have checked off every checkbox in the PR reviewer checklist, including those that don't apply to this PR.

cc: @flodnv

🎀 👀 🎀 C+ reviewed

Copy link
Contributor

@flodnv flodnv left a comment

Choose a reason for hiding this comment

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

👍

Comment on lines -57 to -58
constructor(props) {
super(props);
Copy link
Contributor

Choose a reason for hiding this comment

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

What happened with this comment? If it is compulsory then why are we removing it?

@@ -106,6 +106,7 @@ class ReportDetailsPage extends Component {
OptionsListUtils.getPersonalDetailsForLogins(participants, this.props.personalDetails),
isMultipleParticipant,
);
const menuItems = this.getMenuItems();
Copy link
Contributor

Choose a reason for hiding this comment

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

NAB this variable isn't really necessary

@flodnv flodnv merged commit c172d62 into Expensify:main Jan 30, 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

There are no entries

Meaningless Changes To Duration

Show entries
Name Duration
App start TTI 718.007 ms → 746.404 ms (+28.397 ms, +4.0%)
App start runJsBundle 202.194 ms → 209.194 ms (+7.000 ms, +3.5%)
App start regularAppStart 0.017 ms → 0.016 ms (-0.002 ms, -8.8%)
App start nativeLaunch 21.419 ms → 21.194 ms (-0.226 ms, -1.1%)
Open Search Page TTI 622.617 ms → 601.171 ms (-21.447 ms, -3.4%)
Show details
Name Duration
App start TTI Baseline
Mean: 718.007 ms
Stdev: 29.734 ms (4.1%)
Runs: 669.3747759999242 682.0138489999808 682.3346420000307 684.4323569999542 687.928023000015 694.3363820000086 694.6466520000249 694.7572510000318 695.8419449999928 698.171151000075 699.4235859999899 700.1997499999125 701.7338489999529 707.3784050000831 708.8621600000188 708.9717530000489 711.4601469999179 711.8122950000688 717.4425210000481 724.1564060000237 726.0886119999923 728.2318480000831 729.9331579999998 733.0886280001141 738.531013000058 745.9933170001023 754.14966799994 754.5567350001074 755.4324950000737 755.8698849999346 786.7994899998885 792.2850959999487

Current
Mean: 746.404 ms
Stdev: 26.225 ms (3.5%)
Runs: 703.3444640000816 711.1373230000027 712.7221379999537 713.6373079998884 715.5212950001005 721.8253820000682 724.5757790000644 726.0608900000807 726.959514999995 728.1340320000891 729.6544300001115 732.2691850000992 732.3663449999876 732.4664459999185 736.180980999954 741.0401069999207 742.0167849999852 745.9581589999143 751.2145249999594 755.0379729999695 755.8481399999 759.1037159999833 764.9226649999619 768.2979329999071 768.3041370001156 770.8077849999536 775.3621859999839 776.7773700000253 780.0120339998975 780.231051000068 792.9169670001138 810.233203999931
App start runJsBundle Baseline
Mean: 202.194 ms
Stdev: 18.218 ms (9.0%)
Runs: 180 182 185 186 188 188 189 189 190 191 193 194 194 194 195 195 197 199 199 200 201 205 207 207 213 217 220 234 240 245 251

Current
Mean: 209.194 ms
Stdev: 17.164 ms (8.2%)
Runs: 190 190 191 192 193 193 194 194 195 196 197 197 198 200 204 206 208 209 209 211 219 219 220 223 223 225 226 229 233 239 262
App start regularAppStart Baseline
Mean: 0.017 ms
Stdev: 0.001 ms (7.2%)
Runs: 0.01525900000706315 0.015503000002354383 0.015583999920636415 0.015706000151112676 0.015746999997645617 0.015868999995291233 0.015868999995291233 0.016072999918833375 0.016072999918833375 0.016193999908864498 0.016276000067591667 0.016315999906510115 0.016316999914124608 0.016398000065237284 0.016439000144600868 0.016439000144600868 0.017008000053465366 0.017089999979361892 0.017293000128120184 0.017537999898195267 0.017577999969944358 0.017578000202775 0.017740999814122915 0.0177819998934865 0.0177819998934865 0.01818799995817244 0.018229000037536025 0.018596000038087368 0.019124999875202775 0.019816000014543533 0.019856999861076474

Current
Mean: 0.016 ms
Stdev: 0.001 ms (5.7%)
Runs: 0.013916000025346875 0.014078999869525433 0.014241999946534634 0.014404000015929341 0.014485999941825867 0.014608000172302127 0.014812000095844269 0.014851999934762716 0.015014000004157424 0.015014000004157424 0.015096000162884593 0.015176999848335981 0.01521800016053021 0.015339999925345182 0.015381000004708767 0.015503000002354383 0.015625 0.015705999918282032 0.015705999918282032 0.015868999995291233 0.015909999841824174 0.01607199991121888 0.01607300015166402 0.016195000149309635 0.016398000065237284 0.016478999983519316 0.01676399982534349 0.016805000137537718 0.017090000212192535 0.017333999974653125
App start nativeLaunch Baseline
Mean: 21.419 ms
Stdev: 1.792 ms (8.4%)
Runs: 20 20 20 20 20 20 20 20 20 20 20 20 20 21 21 21 21 21 21 21 21 22 22 22 22 23 24 24 25 26 26

Current
Mean: 21.194 ms
Stdev: 1.203 ms (5.7%)
Runs: 19 20 20 20 20 20 20 20 20 20 21 21 21 21 21 21 21 21 21 21 22 22 22 22 22 22 22 23 23 24 24
Open Search Page TTI Baseline
Mean: 622.617 ms
Stdev: 23.991 ms (3.9%)
Runs: 582.7321780000348 585.3604329999071 590.754924000008 593.8965249999892 597.3948570000939 597.7317299998831 599.4056800000835 600.6584469999652 603.8179929999169 605.4971930000465 605.9010830000043 607.7362069999799 609.4076339998282 612.3699949998409 617.0536300002132 617.8232419998385 621.6997480001301 622.7198079999071 631.5017899998929 631.9543860000558 632.1944989999756 632.5801190000493 632.6912839999422 635.3463950001169 640.0069580001291 640.3213300001808 641.5382490002085 646.2513840000611 649.9109290000051 651.3656820000615 662.6551919998601 671.6201989999972 674.4640299999155

Current
Mean: 601.171 ms
Stdev: 15.222 ms (2.5%)
Runs: 573.5545660001226 577.2741700001061 579.7413330001291 582.2335210000165 583.9612630000338 584.2444260001648 586.3114420000929 587.0322269999888 588.5061860000715 593.8798020000104 594.4326989999972 594.5514330000151 594.880290000001 596.8800460000057 597.6626790000591 602.1748860001098 602.2213950001169 603.0371910000686 604.4159760000184 605.2880869999062 606.8572590001859 607.7139489999972 608.0071620000526 612.7913819998503 613.3092450001277 613.6976320000831 616.9223229999188 617.5378420001362 619.6962890001014 627.0287680001929 628.7548010000028 632.8559980001301

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by https://github.com/flodnv 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