-
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: clear the input when resending validate code #28757
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] |
@aimane-chnaif What's the update here? |
Have you tried to make common component? Seems like @marcaaron still suggests all inconsistencies should be fixed here, not out of scope. |
fwiw, we don't have to fix every inconsistency. It sounded like there was code we are duplicating. So, I asked if we can think of some way to reuse it. If not, or it is too difficult - then we can proceed.
|
@@ -177,6 +177,9 @@ function BaseValidateCodeForm(props) { | |||
*/ | |||
const resendValidateCode = () => { | |||
User.resendValidateCode(props.credentials.login); | |||
setValidateCode(''); | |||
inputValidateCodeRef.current.clear(); | |||
inputValidateCodeRef.current.focus(); |
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.
Why must we clear()
here?
But not here:
App/src/pages/settings/Profile/Contacts/ValidateCodeForm/BaseValidateCodeForm.js
Lines 111 to 115 in cec77d2
const resendValidateCode = () => { | |
User.requestContactMethodValidateCode(props.contactMethod); | |
setValidateCode(''); | |
inputValidateCodeRef.current.focus(); | |
}; |
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.
This code can be optimized in both pages.
So inputValidateCodeRef.current.clear();
should be enough. This calls inputValidateCodeRef.current.focus();
and props.onChangeText('')
followed by setValidateCode('')
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.
Yes. Seems like my local wasn't updated with the latest main. This got changed later on.
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.
@aimane-chnaif Updated.
I think the two components can be composed into a single component that works at both places. However, I feel like this task is beyond the scope of this ticket. Without composition, encapsulating just the input clearing logic into a utility function does not make full sense to me. The utility function would require the input |
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.
can you test these removals still work fine?
inputValidateCodeRef.current.clear(); | ||
setValidateCode(''); |
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.
inputValidateCodeRef.current.clear(); | |
setValidateCode(''); | |
inputValidateCodeRef.current.clear(); |
@@ -177,6 +177,8 @@ function BaseValidateCodeForm(props) { | |||
*/ | |||
const resendValidateCode = () => { | |||
User.resendValidateCode(props.credentials.login); | |||
inputValidateCodeRef.current.clear(); | |||
setValidateCode(''); |
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.
setValidateCode(''); |
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.
@aimane-chnaif Seems to be working fine.
Screen.Recording.2023-10-06.at.3.56.02.AM.mov
Reviewer Checklist
Screenshots/VideosWebweb1.movweb2.movMobile Web - Chromemchrome.movMobile Web - Safarimsafari.movDesktopdesktop.moviOSios1.movios2.movAndroidandroid.mov |
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.
LGTM
@marcaaron all yours
✋ 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/marcaaron in version: 1.3.79-0 🚀
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 1.3.79-5 🚀
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 1.3.79-5 🚀
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 1.3.79-5 🚀
|
Details
This PR resets the magic code field when
Resent validate code
button is clicked.Fixed Issues
$ #28553
PROPOSAL: #28553 (comment)
Tests
Offline tests
N/A
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)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)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)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
Web
Screen.Recording.2023-10-04.at.4.13.34.AM.mov
Mobile Web - Chrome
Screen.Recording.2023-10-04.at.4.16.23.AM.mov
Mobile Web - Safari
Screen.Recording.2023-10-04.at.4.16.04.AM.mov
Desktop
Screen.Recording.2023-10-04.at.4.22.32.AM.mov
iOS
Screen.Recording.2023-10-04.at.4.18.41.AM.mov
Android
Screen.Recording.2023-10-04.at.4.18.16.AM.mov