-
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
Refactor BaseValidateCodeForm.js to functional component #20480
Conversation
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA |
@s77rt @AndrewGable 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] |
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.
Just quick changes to get this moving (will continue review).
useEffect(() => { | ||
if (!inputValidateCode || wasVisible || !props.isVisible || !canFocusInputOnScreenFocus()) { | ||
return; | ||
} | ||
this.inputValidateCode.focus(); | ||
} | ||
inputValidateCode.focus(); | ||
}, [inputValidateCode, props.isVisible, wasVisible]); |
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 seems okay but it actually change the current behaviour as if it was coded as:
componentDidUpdate(prevProps) {
if (canFocusInputOnScreenFocus() && !prevProps.isVisible && this.props.isVisible) {
this.inputValidateCode.focus();
}
This may be fine so I asked here #13655 (comment)
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.
Actually, I don't think canFocusInputOnScreenFocus
can change in the lifetime of the app because it relies on user agent. So we might only need to check it once, though I don't think that's much of an issue
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.
It won't change but the current logic used to relay on that function only on component mount, Now with the refactor it's treated as if that function was being used on componentDIdUpdate too. This is not necessary a bad change, just asked for a confirmation in the linked PR.
@Li357 Please resolve conflicts |
Reviewer Checklist
Screenshots/VideosWebweb.mp4Mobile Web - Chromemweb-chrome.mp4Mobile Web - Safarimweb-safari.mp4Desktopdesktop.mp4iOSios.mp4Androidandroid.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.
LGTM! 🚀
cc @AndrewGable
🚀 Deployed to staging by https://github.com/AndrewGable in version: 1.3.27-0 🚀
|
🚀 Deployed to staging by https://github.com/AndrewGable in version: 1.3.27-0 🚀
|
🚀 Deployed to production by https://github.com/AndrewGable in version: 1.3.27-7 🚀
|
Details
Refactor src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.js to functional component
Fixed Issues
$ #16302
Tests
Offline tests
Offline disables sign in button and form does not submit
QA Steps
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)/** 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
pr-web-chrome.mov
web.mov
Mobile Web - Chrome
Mobile Web - Safari
Simulator.Screen.Recording.-.iPhone.14.16.1.-.2023-06-08.at.16.05.39.mp4
Desktop
desktop-no-2fa.mov
iOS
Simulator.Screen.Recording.-.iPhone.14.16.1.-.2023-06-08.at.15.55.04.mp4
Simulator.Screen.Recording.-.iPhone.14.16.1.-.2023-06-08.at.15.56.57.mp4
Android