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

Recompute number of lines for Composer when window width changes #15020

Merged
merged 1 commit into from
Feb 10, 2023

Conversation

francoisl
Copy link
Contributor

@francoisl francoisl commented Feb 10, 2023

Details

When you resize your window on desktop (browser or desktop app), automatically adjust the number of lines in the composer when necessary, so that the message doesn't look clipped.

Fixed Issues

$ #15000

Tests

  1. Type in the message in the composer that's somewhat long (e.g. a few lines)
  2. Resize your window
  3. As you shrink or extend the window, make sure the height of the composer automatically adjusts so that the message fully visible
  • Verify that no errors appear in the JS console

Offline tests

The same test steps should work while offline.

QA Steps

  1. Type in the message in the composer that's somewhat long (e.g. a few lines)
  2. Resize your window
  3. As you shrink or extend the window, make sure the height of the composer automatically adjusts so that the message fully visible
  • 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-02-09.at.4.21.25.PM.mov
Mobile Web - Chrome

N/A

Mobile Web - Safari

N/A

Desktop
Screen.Recording.2023-02-09.at.4.21.40.PM.mov
iOS

N/A

Android

N/A

@francoisl francoisl marked this pull request as ready for review February 10, 2023 00:32
@francoisl francoisl requested a review from a team as a code owner February 10, 2023 00:32
@melvin-bot melvin-bot bot requested review from puneetlath and rushatgabhane and removed request for a team February 10, 2023 00:33
@MelvinBot
Copy link

@rushatgabhane @puneetlath 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]

@rushatgabhane
Copy link
Member

rushatgabhane commented Feb 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
Screen.Recording.2023-02-10.at.9.06.03.AM.mov
Mobile Web - Chrome
WhatsApp.Video.2023-02-10.at.09.10.39.mp4
Mobile Web - Safari image
Desktop
Untitled.8.mp4
iOS image
Android
WhatsApp.Video.2023-02-10.at.09.18.50.mp4

@rushatgabhane
Copy link
Member

@puneetlath all yours!

Copy link
Contributor

@puneetlath puneetlath left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@puneetlath puneetlath merged commit c301e8a into main Feb 10, 2023
@puneetlath puneetlath deleted the francois-adjustComposerLinesOnWindowResize branch February 10, 2023 16:22
@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 717.402 ms → 751.739 ms (+34.337 ms, +4.8%)
App start runJsBundle 197.774 ms → 206.500 ms (+8.726 ms, +4.4%)
App start nativeLaunch 19.871 ms → 20.065 ms (+0.194 ms, +1.0%)
App start regularAppStart 0.017 ms → 0.016 ms (-0.002 ms, -9.8%)
Open Search Page TTI 617.876 ms → 615.112 ms (-2.764 ms, ±0.0%)
Show details
Name Duration
App start TTI Baseline
Mean: 717.402 ms
Stdev: 24.019 ms (3.3%)
Runs: 658.3374870000407 680.712957999669 687.1813869997859 689.7369849998504 690.9919140003622 698.4220899995416 698.4430080000311 699.250610999763 699.3082670001313 702.7021559998393 705.2646000003442 711.3543229997158 713.0299930004403 713.14486400038 714.9502640003338 718.1362600000575 718.4223319999874 723.9421960003674 724.2126559996977 728.1478810003027 730.761314000003 731.5249469997361 731.7078430000693 731.9163640001789 732.3565889997408 734.0360120004043 743.203630999662 746.3983349995688 751.7188149997965 757.2015749998391 772.9509399998933

Current
Mean: 751.739 ms
Stdev: 35.927 ms (4.8%)
Runs: 688.4311680002138 692.5858450001106 696.210909999907 699.771080000326 707.9307869998738 724.8565809996799 725.2432140000165 725.859656999819 726.3786559998989 729.102806000039 730.0930300001055 730.7556630000472 740.8357950001955 745.2425659997389 746.5667939996347 746.6648209998384 751.9455209998414 758.842307000421 760.6696530003101 765.5969160003588 766.3060699999332 766.4070340003818 769.9577670004219 771.0089210001752 772.9265780001879 783.8893910003826 784.3399019995704 793.2364459997043 797.154531000182 803.8038499997929 821.780210999772 831.2457459997386
App start runJsBundle Baseline
Mean: 197.774 ms
Stdev: 15.708 ms (7.9%)
Runs: 171 171 173 178 179 182 185 185 185 187 188 189 196 198 198 199 200 200 201 203 207 208 208 208 212 212 214 219 220 227 228

Current
Mean: 206.500 ms
Stdev: 18.738 ms (9.1%)
Runs: 172 183 183 185 186 187 188 191 193 194 195 196 196 199 200 206 206 206 206 211 214 216 218 219 220 224 226 233 233 234 242 246
App start nativeLaunch Baseline
Mean: 19.871 ms
Stdev: 1.827 ms (9.2%)
Runs: 18 18 18 18 18 18 18 18 18 18 19 19 19 19 19 20 20 20 20 20 21 21 21 21 21 21 22 22 22 24 25

Current
Mean: 20.065 ms
Stdev: 1.900 ms (9.5%)
Runs: 18 18 18 18 18 18 18 19 19 19 19 19 19 19 19 19 20 20 20 20 21 21 21 21 22 22 22 23 23 24 25
App start regularAppStart Baseline
Mean: 0.017 ms
Stdev: 0.002 ms (9.7%)
Runs: 0.014281999319791794 0.01448499970138073 0.015747000463306904 0.0157880000770092 0.015909000299870968 0.016071999445557594 0.016112999990582466 0.016479999758303165 0.016479999758303165 0.016642999835312366 0.016682999208569527 0.016764000058174133 0.01680499967187643 0.017008000053465366 0.017130999825894833 0.017292999662458897 0.01737500075250864 0.017456000670790672 0.017496000044047832 0.01749700028449297 0.017862999811768532 0.018309999257326126 0.01839200034737587 0.01843199972063303 0.018596000038087368 0.018717000260949135 0.0197350000962615 0.020263000391423702 0.0206300001591444 0.02071200031787157 0.02128100022673607

Current
Mean: 0.016 ms
Stdev: 0.001 ms (6.0%)
Runs: 0.014200999401509762 0.014322999864816666 0.014405000023543835 0.014566999860107899 0.01464799977838993 0.014974000863730907 0.015015000477433205 0.015300000086426735 0.01534000039100647 0.01534000039100647 0.015381000004708767 0.015421999618411064 0.015462999232113361 0.01550300046801567 0.015583999454975128 0.015584000386297703 0.015584999695420265 0.0157880000770092 0.015828999690711498 0.015990999527275562 0.015991000458598137 0.016194000840187073 0.016195000149309635 0.016235999763011932 0.016479999758303165 0.016845999285578728 0.016887000761926174 0.01733400020748377 0.01737399958074093 0.017578000202775 0.0179449999704957
Open Search Page TTI Baseline
Mean: 617.876 ms
Stdev: 17.593 ms (2.8%)
Runs: 589.3458659993485 590.521972999908 592.0771890003234 595.490438000299 597.637532999739 599.5930180000141 604.3372809998691 605.177733999677 605.5207520006225 606.5297860000283 606.6628009993583 607.9080400001258 608.3466799994931 609.2718910006806 611.3535970002413 611.3665370000526 617.1281739994884 619.6396079994738 620.0512290000916 620.9029139997438 621.0832110000774 621.832032000646 624.4698080001399 629.5866299998015 632.9619150003418 633.6424969993532 634.4428719999269 641.2045489996672 641.67834499944 642.3872889997438 648.6058759996668 649.0853679999709 650.0580249996856

Current
Mean: 615.112 ms
Stdev: 15.845 ms (2.6%)
Runs: 588.0227049998939 594.130941000767 594.1677660001442 595.3978279996663 595.7742109997198 598.8573000002652 599.2349450001493 599.2864179993048 600.2802740000188 603.4428709996864 606.671753000468 606.9746099999174 609.4703369997442 610.0708830002695 612.3550619995221 612.976197000593 613.9750159997493 614.4195959996432 615.9257810004056 616.271851000376 622.6529950005934 623.5440670000389 623.8973790006712 625.994589000009 628.8881430001929 629.2604580000043 630.396646999754 630.9562179995701 631.1541750002652 631.3435060000047 634.8518880000338 639.8911950001493 658.1601970000193

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by https://github.com/puneetlath in version: 1.2.70-0 🚀

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

1 similar comment
@OSBotify
Copy link
Contributor

🚀 Deployed to staging by https://github.com/puneetlath in version: 1.2.70-0 🚀

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

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by https://github.com/puneetlath in version: 1.2.70-0 🚀

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

@OSBotify
Copy link
Contributor

🚀 Deployed to production by https://github.com/francoisl in version: 1.2.70-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.

5 participants