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

SelectionScraper: Shift range end container while end offset is zero #15164

Merged
merged 1 commit into from
Feb 22, 2023

Conversation

s77rt
Copy link
Contributor

@s77rt s77rt commented Feb 15, 2023

Details

Shift range end container while end offset is zero

Fixed Issues

$ #14939
PROPOSAL: #14939 (comment)

Tests

  1. Go to any chat
  2. Send a plaintext message: To copy msg
  3. Send a formatted inline code message: inline code
    • Web/Desktop: Triple click on the first message then copy it to clipboard
    • Android/iOS/mWeb: Copy the first message to clipboard
  4. Paste the copied message to the composer
  5. Verify that the composer holds the copied message "To copy msg" without any extra characters
  • Verify that no errors appear in the JS console

Offline tests

n/a

QA Steps

  1. Go to any chat
  2. Send a plaintext message: To copy msg
  3. Send a formatted inline code message: inline code
    • Web/Desktop: Triple click on the first message then copy it to clipboard
    • Android/iOS/mWeb: Copy the first message to clipboard
  4. Paste the copied message to the composer
  5. Verify that the composer holds the copied message "To copy msg" without any extra characters
  • 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
web.mp4
Mobile Web - Chrome
mweb-chrome.mp4
Mobile Web - Safari
mweb-safari.mp4
Desktop
desktop.mp4
iOS
ios.mp4
Android
android.mp4

@s77rt s77rt requested a review from a team as a code owner February 15, 2023 10:14
@melvin-bot melvin-bot bot requested review from AndrewGable and sobitneupane and removed request for a team February 15, 2023 10:14
@MelvinBot
Copy link

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

Screenshots/Videos

Web
Screen.Recording.2023-02-16.at.11.23.17.mov
Mobile Web - Chrome
Screen.Recording.2023-02-16.at.12.07.44.mov
Mobile Web - Safari
Screen.Recording.2023-02-16.at.12.16.35.mov
Desktop
Screen.Recording.2023-02-16.at.11.59.32.mov
iOS
Screen.Recording.2023-02-16.at.12.15.00.mov
Android
Screen.Recording.2023-02-16.at.12.13.53.mov

@sobitneupane
Copy link
Contributor

I noticed few issues like addition of extra line while trying to copy quote messages. It is reproducible in staging as well. It is an issue different from that of the issue for which this PR is created. But might have the similar root cause. @s77rt What do you think?

Screen.Recording.2023-02-16.at.12.27.47.mov

@s77rt
Copy link
Contributor Author

s77rt commented Feb 16, 2023

@sobitneupane Thanks for the quick review! As for the other issue I think it's unrelated and have different root cause which is the parser

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

@sobitneupane
Copy link
Contributor

@AndrewGable We are waiting for your review.

@AndrewGable AndrewGable merged commit 813a16a into Expensify:main Feb 22, 2023
@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 708.788 ms → 717.441 ms (+8.653 ms, +1.2%)
App start regularAppStart 0.014 ms → 0.014 ms (+0.000 ms, ±0.0%)
App start nativeLaunch 19.719 ms → 19.367 ms (-0.352 ms, -1.8%)
App start runJsBundle 201.906 ms → 200.500 ms (-1.406 ms, -0.7%)
Open Search Page TTI 618.876 ms → 604.163 ms (-14.712 ms, -2.4%)
Show details
Name Duration
App start TTI Baseline
Mean: 708.788 ms
Stdev: 33.254 ms (4.7%)
Runs: 648.1584600005299 652.1728930007666 662.5905200000852 671.3255920000374 671.8662669993937 673.981901999563 678.230110000819 679.4531469997019 681.1746789999306 695.8283980004489 697.3906900007278 699.3788859993219 700.4482289999723 704.1763489991426 706.5779160000384 708.0664980001748 709.4823189992458 712.2596870008856 717.5086029991508 720.4454270005226 721.9394129998982 724.4578089993447 725.6442460007966 728.8418049998581 729.1271189991385 733.1883949991316 750.6182090006769 755.3876200001687 756.4614760000259 771.084422999993 785.1714420001954

Current
Mean: 717.441 ms
Stdev: 27.587 ms (3.8%)
Runs: 665.4914170000702 668.8203040007502 674.5424949992448 677.0149709992111 688.1533659994602 693.6499969996512 694.3776639997959 694.4730239994824 695.0567749999464 698.1193930003792 698.4895120002329 704.9891529995948 706.9523760005832 707.6642140001059 719.1682649999857 719.6456509996206 721.8148270007223 722.2955709993839 726.8746089991182 728.5939990002662 731.3512709997594 734.937384000048 737.285041000694 738.8582210000604 740.1376249995083 740.8044789992273 741.372847000137 747.2668329998851 752.6167089994997 754.2038880009204 756.8723549991846 776.2227599993348
App start regularAppStart Baseline
Mean: 0.014 ms
Stdev: 0.001 ms (5.6%)
Runs: 0.012452000752091408 0.01269499957561493 0.012736000120639801 0.012736000120639801 0.012899000197649002 0.012938998639583588 0.013182999566197395 0.013225000351667404 0.01330600120127201 0.01342800073325634 0.01355000026524067 0.013712000101804733 0.013753000646829605 0.013753000646829605 0.013876000419259071 0.013915998861193657 0.013957001268863678 0.013957001268863678 0.01407800056040287 0.014078998938202858 0.014119001105427742 0.014282001182436943 0.014322999864816666 0.014323001727461815 0.01440499909222126 0.014485999941825867 0.014485999941825867 0.014485999941825867 0.014526000246405602 0.015095999464392662 0.01533999852836132 0.01574699953198433

Current
Mean: 0.014 ms
Stdev: 0.001 ms (5.9%)
Runs: 0.012614000588655472 0.01269499957561493 0.012736000120639801 0.01285799965262413 0.012897999957203865 0.012938998639583588 0.012940000742673874 0.01297999918460846 0.013061000034213066 0.013467999175190926 0.013508999720215797 0.013631999492645264 0.01371300034224987 0.01371300034224987 0.0138349998742342 0.0138349998742342 0.013875998556613922 0.013997001573443413 0.014038000255823135 0.014079000800848007 0.014161000028252602 0.014363998547196388 0.01448499970138073 0.014527000486850739 0.014566998928785324 0.014566998928785324 0.014607999473810196 0.014729999005794525 0.01476999931037426 0.014852000400424004 0.015625 0.015665998682379723
App start nativeLaunch Baseline
Mean: 19.719 ms
Stdev: 1.956 ms (9.9%)
Runs: 17 17 18 18 18 18 18 18 18 18 18 19 19 19 19 19 19 19 20 20 20 21 21 21 21 21 21 22 22 23 24 25

Current
Mean: 19.367 ms
Stdev: 1.663 ms (8.6%)
Runs: 17 17 17 18 18 18 18 18 18 18 18 19 19 19 19 19 19 19 20 20 20 20 21 21 21 21 21 22 22 24
App start runJsBundle Baseline
Mean: 201.906 ms
Stdev: 31.533 ms (15.6%)
Runs: 160 163 164 169 171 174 175 176 178 181 184 185 187 191 192 193 194 200 202 205 205 214 215 217 220 221 222 228 252 267 274 282

Current
Mean: 200.500 ms
Stdev: 21.721 ms (10.8%)
Runs: 161 165 166 174 177 180 181 182 182 187 188 190 192 194 195 200 204 204 208 210 211 213 214 215 218 220 220 223 224 226 244 248
Open Search Page TTI Baseline
Mean: 618.876 ms
Stdev: 22.738 ms (3.7%)
Runs: 586.5091149993241 593.1571460012347 594.1500649992377 595.2797040008008 596.2852380014956 597.4783130008727 600.6540939994156 601.0152589995414 602.1804610006511 603.6108810007572 603.7666420005262 605.3396000005305 606.3089199997485 606.7490240000188 606.8394779991359 608.0450440011919 608.0742600001395 610.628092000261 615.4713949989527 617.1684579998255 620.6238199993968 624.7111000008881 625.1808679997921 634.4600830003619 635.7018229998648 641.809366999194 642.8809409998357 643.4435230009258 644.646891001612 650.7419440001249 662.765177000314 665.9539390001446 671.2632649987936

Current
Mean: 604.163 ms
Stdev: 17.116 ms (2.8%)
Runs: 572.6956379991025 579.2919520009309 581.4483239986002 582.1582440007478 584.0905770007521 584.2688810005784 589.0517990011722 590.7563879992813 592.6801760010421 594.4892579987645 595.8141280002892 596.5297860000283 597.0967199988663 599.5094809997827 599.6200770009309 601.6676429994404 601.8975419998169 601.9557699989527 603.6584069989622 604.879313999787 606.0633550006896 609.606526998803 610.235270999372 611.1204840000719 614.8934729993343 622.609170999378 622.9252119995654 624.5199790000916 627.9709479995072 630.106282999739 631.44165099971 633.2891039997339 639.047729998827

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by https://github.com/AndrewGable in version: 1.2.76-0 🚀

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

@OSBotify
Copy link
Contributor

🚀 Deployed to production by https://github.com/yuwenmemon in version: 1.2.76-7 🚀

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

1 similar comment
@OSBotify
Copy link
Contributor

🚀 Deployed to production by https://github.com/yuwenmemon in version: 1.2.76-7 🚀

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

@OSBotify
Copy link
Contributor

🚀 Deployed to production by https://github.com/yuwenmemon in version: 1.2.76-7 🚀

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