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

Return to createPortal to properly recalculate tooltipTextWidth #14171

Merged
merged 2 commits into from
Jan 10, 2023

Conversation

alex-mechler
Copy link
Contributor

Details

<Portal> has at least a 1 render delay, causing the recalculations for tool tip width to fail. This reverts that change back to a createPortal to solve the issue. The switch was made here https://github.com/Expensify/App/pull/12168/files#diff-8ddd0f734fe2c1d30cad34482aa6bd982defac075f3e33fdd0de81976066d324R121

Fixed Issues

$ #14149
PROPOSAL: https://expensify.slack.com/archives/C01GTK53T8Q/p1673312891811939?thread_ts=1673312306.906289&cid=C01GTK53T8Q

Tests

  1. Navigate to a chat
  2. Hover the pin icon
  3. Verify the tooltip appears
  4. Click the pin icon
  5. Verify the text on the tool tip changes, and the tool tips size is properly recalculated, and the text is on 1 line
  6. Click the pin icon again
  7. Verify the text on the tool tip changes back
  • Verify that no errors appear in the JS console

Offline tests

Same as tests

QA Steps

  1. Navigate to a chat
  2. Hover the pin icon
  3. Verify the tooltip appears
  4. Click the pin icon
  5. Verify the text on the tool tip changes, and the tool tips size is properly recalculated, and the text is on 1 line
  6. Click the pin icon again
  7. Verify the text on the tool tip changes back
  • 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
    • 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-09_17-25-39.mp4
Mobile Web - Chrome

N/a doesnt support tooltips

Mobile Web - Safari

N/a doesnt support tooltips

Desktop
2023-01-09_17-28-26.mp4
iOS

N/a doesnt support tooltips

Android

N/a doesnt support tooltips

@alex-mechler alex-mechler self-assigned this Jan 10, 2023
@alex-mechler alex-mechler requested a review from a team as a code owner January 10, 2023 01:29
@melvin-bot melvin-bot bot requested review from deetergp and thesahindia and removed request for a team January 10, 2023 01:29
@melvin-bot
Copy link

melvin-bot bot commented Jan 10, 2023

@thesahindia @deetergp 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

@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.

Thanks for the quick fix. I'm going to take over the C+ checklist in order to speed up the NewDot deploy.

@Julesssss Julesssss removed the request for review from thesahindia January 10, 2023 15:30
@Julesssss
Copy link
Contributor

Julesssss commented Jan 10, 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

Screenshot 2023-01-10 at 15 36 51

Desktop

Screenshot 2023-01-10 at 15 40 11

Other

All other platforms do not show the hover tooltip

@Julesssss Julesssss merged commit ba61986 into main Jan 10, 2023
@Julesssss Julesssss deleted the amechler-unpin-2-lines branch January 10, 2023 15:42
@Julesssss
Copy link
Contributor

Julesssss commented Jan 10, 2023

Manually Cherry-picking, as I forgot to add the label 🤦

@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.

OSBotify pushed a commit that referenced this pull request Jan 10, 2023
Return to createPortal to properly recalculate tooltipTextWidth

(cherry picked from commit ba61986)
OSBotify added a commit that referenced this pull request Jan 10, 2023
…g-14171

🍒 Cherry pick PR #14171 to staging 🍒
@Julesssss
Copy link
Contributor

Success.

@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 nativeLaunch 9.724 ms → 19.867 ms (+10.143 ms, +104.3%) 🟡
App start regularAppStart 0.014 ms → 0.021 ms (+0.007 ms, +51.1%) 🟡
App start runJsBundle 188.871 ms → 187.500 ms (-1.371 ms, -0.7%)
Open Search Page TTI 606.728 ms → 604.483 ms (-2.245 ms, ±0.0%)
App start TTI 687.422 ms → 682.007 ms (-5.415 ms, -0.8%)
Show details
Name Duration
App start nativeLaunch Baseline
Mean: 9.724 ms
Stdev: 1.200 ms (12.3%)
Runs: 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 11 11 11 12 12 13

Current
Mean: 19.867 ms
Stdev: 1.857 ms (9.3%)
Runs: 17 18 18 18 18 18 18 19 19 19 19 19 19 19 19 20 20 20 20 20 20 20 20 21 22 22 22 23 24 25
App start regularAppStart Baseline
Mean: 0.014 ms
Stdev: 0.001 ms (8.6%)
Runs: 0.012288999743759632 0.012492000125348568 0.012695000506937504 0.012735999189317226 0.012980000115931034 0.013021000660955906 0.013182999566197395 0.013224000111222267 0.01322499942034483 0.013264999724924564 0.013387000188231468 0.013469000346958637 0.013509000651538372 0.013509000651538372 0.01355000026524067 0.01355000026524067 0.013712000101804733 0.013956000097095966 0.01416000071913004 0.014485999941825867 0.014485999941825867 0.0147299999371171 0.014810999855399132 0.015258999541401863 0.015258999541401863 0.015625 0.015747999772429466 0.01603199914097786 0.017578999511897564

Current
Mean: 0.021 ms
Stdev: 0.002 ms (8.1%)
Runs: 0.018106999807059765 0.01818800065666437 0.01879899948835373 0.019042999483644962 0.019084000028669834 0.01912400033324957 0.01981700025498867 0.019979000091552734 0.020060000009834766 0.020263999700546265 0.02042599953711033 0.020507999695837498 0.0206300001591444 0.020711000077426434 0.02095599938184023 0.020956000313162804 0.02103699930012226 0.021158999763429165 0.02144400030374527 0.021688000299036503 0.021972999908030033 0.022094999440014362 0.022338999435305595 0.0224609998986125 0.0228279996663332 0.022867999970912933 0.022907999344170094 0.0236820001155138 0.023967000655829906 0.024170000106096268 0.024536000564694405
App start runJsBundle Baseline
Mean: 188.871 ms
Stdev: 26.359 ms (14.0%)
Runs: 150 152 153 161 164 167 169 172 174 175 177 178 178 180 180 182 182 185 188 189 194 195 198 207 211 213 218 221 240 249 253

Current
Mean: 187.500 ms
Stdev: 18.381 ms (9.8%)
Runs: 156 160 164 165 165 167 169 173 176 177 178 179 179 180 181 184 186 187 191 191 192 195 197 204 206 206 209 212 213 216 218 224
Open Search Page TTI Baseline
Mean: 606.728 ms
Stdev: 21.525 ms (3.5%)
Runs: 571.9018550002947 573.2600910002366 574.0170490005985 580.1104739997536 581.9352219998837 583.8676350004971 588.2545170001686 588.7690429994836 590.652710000053 593.6906329998747 594.937336999923 597.8161619994789 598.6549479998648 599.7863769996911 600.0256350003183 607.4034430002794 610.7083339998499 612.0604249993339 612.4839279996231 612.9267179993913 613.2729899995029 616.4999190000817 617.2799480007961 618.9083670005202 621.1529129995033 621.4412850001827 626.0463870000094 630.816813999787 632.2016610000283 633.775065000169 647.7749030003324 662.8609620006755

Current
Mean: 604.483 ms
Stdev: 18.128 ms (3.0%)
Runs: 570.1129159992561 571.8894459996372 583.4101559994742 583.54764899984 586.0878500007093 586.3274339996278 587.3467610003427 588.1269530002028 588.621012000367 589.1276449998841 593.2344159996137 595.4626870006323 596.8518890002742 602.2971200002357 603.5137130003422 605.9979659998789 606.172201000154 606.3708500005305 607.1448160000145 609.6586910001934 610.1713460003957 610.4606529995799 610.6440840000287 612.0345059996471 616.2014159997925 616.3531499998644 619.4779869997874 622.0309250000864 624.1369230002165 627.6260169995949 630.0923260003328 638.1881919996813 649.203125
App start TTI Baseline
Mean: 687.422 ms
Stdev: 38.459 ms (5.6%)
Runs: 611.2337880004197 634.2814520001411 641.9130229996517 643.1155639998615 643.7093150001019 651.0632480001077 651.559786000289 658.7830149997026 659.7626059995964 661.7067550001666 665.9913379997015 670.9286719998345 675.3029270004481 675.3841230003163 676.4941689996049 680.0031690001488 689.1787930000573 689.8608210003003 692.8331140000373 693.204888000153 695.276783999987 696.5556910000741 699.381400000304 716.3553630001843 716.9735049996525 718.3708809996024 723.8245919998735 731.0752839995548 745.6338809998706 755.7419410003349 761.5819699997082 770.4242890002206

Current
Mean: 682.007 ms
Stdev: 30.030 ms (4.4%)
Runs: 632.4501010002568 633.7322840001434 633.8802580004558 642.6572709996253 649.8408709997311 650.1201809998602 655.3235189998522 657.3542370004579 664.2792819999158 664.6581589998677 664.9759830003604 666.8729590000585 668.121026000008 679.2807830004022 681.314102999866 682.779470000416 683.1921110004187 683.5069350004196 684.3229250004515 689.588557000272 690.1084179999307 692.7586850002408 693.4901959998533 701.4933380000293 706.8582020001486 708.5110269999132 714.2032519998029 717.9082150002941 719.9480339996517 723.0960029996932 730.9143049996346 756.6698160003871

@OSBotify
Copy link
Contributor

🚀 Deployed to production by @Julesssss in version: 1.2.51-1 🚀

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

@OSBotify
Copy link
Contributor

🚀 Cherry-picked to staging by @Julesssss in version: 1.2.51-1 🚀

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

@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes.

@OSBotify
Copy link
Contributor

🚀 Cherry-picked to staging by https://github.com/AndrewGable in version: 1.3.28-2 🚀

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

@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes.

@OSBotify
Copy link
Contributor

🚀 Deployed to production by https://github.com/AndrewGable in version: 1.3.28-5 🚀

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

@eVoloshchak eVoloshchak mentioned this pull request May 29, 2024
50 tasks
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