-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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: delay in displaying comment length limit error #33848
Conversation
@abdulrahuman5196 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] |
@@ -19,7 +19,7 @@ const useHandleExceedMaxCommentLength = () => { | |||
[hasExceededMaxCommentLength], | |||
); | |||
|
|||
const validateCommentMaxLength = useMemo(() => _.debounce(handleValueChange, 1500), [handleValueChange]); | |||
const validateCommentMaxLength = useMemo(() => _.debounce(handleValueChange, 500, {leading: true}), [handleValueChange]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aswin-s I don't think we need to reduce the timeout. Any reason to do it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1.5 seconds feels a bit too much in my testing. It waits for 1.5 seconds after last invocation to trigger the check. 500ms felt like a safe middle ground. The issue gets fixed even without the change in timing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@abdulrahuman5196 Do you think it is safe to revert the timeout change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should only do the computation once the user stops typing and gives a pause, since it could add computational overhead to compute the error sooner. That's why I assume we kept it at 1500 ms. I think for this PR, it should be fine to leave it as it is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@abdulrahuman5196 I've reverted the timeout change.
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-01-03.at.3.54.28.PM.mp4Android: mWeb ChromeScreen.Recording.2024-01-03.at.4.03.59.PM.mp4iOS: NativeScreen.Recording.2024-01-03.at.3.45.07.PM.mp4iOS: mWeb SafariScreen.Recording.2024-01-03.at.3.52.30.PM.mp4MacOS: Chrome / SafariScreen.Recording.2024-01-03.at.3.40.24.PM.mp4MacOS: DesktopScreen.Recording.2024-01-03.at.3.42.52.PM.mp4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes looks good and works well. Reviewers checklist is also complete.
All yours. @tylerkaraszewski
🎀 👀 🎀
C+ Reviewed
✋ 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/tylerkaraszewski in version: 1.4.22-0 🚀
|
🚀 Deployed to staging by https://github.com/tylerkaraszewski in version: 1.4.22-0 🚀
|
🚀 Deployed to production by https://github.com/thienlnam in version: 1.4.22-6 🚀
|
Details
This PR fixes an issue where the error message for exceeding character limit in composer was delayed on first render.
Fixed Issues
$ #33612
PROPOSAL: #33612 (comment)
Tests
The maximum comment length is 10,000 characters
is only shown without any delay.Offline tests
The maximum comment length is 10,000 characters
is only shown without any delay.QA Steps
The maximum comment length is 10,000 characters
is only shown without any delay.PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
android.mp4
Android: mWeb Chrome
android-web.mp4
iOS: Native
ios.mp4
iOS: mWeb Safari
ios-web.mp4
MacOS: Chrome / Safari
web.mp4
MacOS: Desktop
desktop.mp4