Repository navigation
Search throttle for emoji picker web - #23846
Conversation
|
@aimane-chnaif Please 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] |
|
Tried it, lgtm! :) |
| forwardedRef: () => {}, | ||
| preferredSkinTone: CONST.EMOJI_DEFAULT_SKIN_TONE, | ||
| }; | ||
| const throttleTime = Browser.isMobile() ? 200 : 50; |
There was a problem hiding this comment.
Browser.isMobile involves mWeb as well. So you meant 50 on web/desktop, 200 on native/mWeb?
There was a problem hiding this comment.
Yes, the idea was to use the smallest timeout for more powerful web/desktop machines and slightly decrease it (from 300 to 200) for mobile devices
| this.shouldFocusInputOnScreenFocus = canFocusInputOnScreenFocus(); | ||
|
|
||
| this.filterEmojis = _.debounce(this.filterEmojis.bind(this), 300); | ||
| this.filterEmojis = _.throttle(this.filterEmojis.bind(this), throttleTime); |
There was a problem hiding this comment.
What's the advantage of throttle vs debounce here?
There was a problem hiding this comment.
I used throttle because it invokes a function at specified intervals, so even if we type fast, it would still be called every 50/200 ms. With debounce, we would wait for 50/200 ms after the last user input before invoking the function. Hence, there were instances when users typed quickly and didn't see the immediate result.
|
@aimane-chnaif does it work for you? |
debounce-50.movdebounce-300.movthrottle-50.movthrottle-300.mov |
|
@perunt I think we should use debounce. i.e. when type |
|
The main issue was being unable to see changes from the input while typing. That's why we need to do a call at the end of a specific time period (throttle) instead of after a certain period following the last keypress (debounce). We could consider extending these periods. Currently, on your machine, it's set to 50ms. I think this is okay since it's not a mobile device, and even on an older laptop, it shouldn't make the app appear laggy. So, what we can do here:
Have you tested it on a mobile device? How does it feel there(it uses 200ms)? |
|
@aimane-chnaif, what do you think about these options? |
|
@aimane-chnaif, what is the future of this PR? |
|
@stitesExpensify , sorry for disturbing you over such minor stuff, but it would be great if you could either merge it or close it. Wdyt? |
If we are fine with this, we can merge with throttle solution |
|
It depends on how fast you are typing. It would be called once, everything above 200ms will cause a new invocation. |
|
Ah sorry @perunt I wasn't assigned as a reviewer so I didn't know this PR existed. I don't see any downside to merging this do you @aimane-chnaif ? If not could you please do the checklist and we will get this closed out? |
|
All's good, I just don't want to leave any PR hanging |
|
Please merge main. I will checklist shortly |
|
done |
|
@aimane-chnaif, did you have time for it? I just want merge or close it. |
|
Sorry for delay |
Reviewer Checklist
Screenshots/VideosWebweb.movMobile Web - Chromemchrome.movMobile Web - Safarimsafari.movDesktopiOSAndroid |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/stitesExpensify in version: 1.3.86-0 🚀
|
|
🚀 Deployed to production by https://github.com/francoisl in version: 1.3.86-5 🚀
|
Details
Fixed Issues
$ #21055 (comment)
PROPOSAL: #21055 (comment)
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)/** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Web
After.mov
Mobile Web - Chrome
telegram-cloud-document-2-5341759699161197574.mp4
Mobile Web - Safari
Desktop
iOS
Android