fix: cursor lag during typing on mWeb SignIn page#60941
Conversation
|
@hungvu193 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] |
|
All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
| const [login, setLoginState] = useState(() => Str.removeSMSDomain(credentials?.login ?? '')); | ||
|
|
||
| const setLogin = useCallback((newLogin: string) => { | ||
| setLoginState(Str.removeSMSDomain(newLogin)); |
There was a problem hiding this comment.
I don't think we need to removeSMSDomain everytime we change the login. setLoginState(newLogin) is just enough.
Can you explain?
There was a problem hiding this comment.
Yes, I agree with you, I just wasn't sure if it was needed in setLogin, so I added it just in case.
I will update the PR now
There was a problem hiding this comment.
@hungvu193 I have a question, today before doing the PR I checked for eslint errors and there were none (I called it with the npm run lint-changed command). Now I call this command and I get 13 errors, even though they don't even refer to parts of my code, what could be the problem?
Do I need to fix them? Because I see that there are no new changes related to eslint or these pages on the main branch that would be related to this code
There was a problem hiding this comment.
For example, an error is thrown on this line, although it is not related to my code and is identical to the code on the main branch
App/src/pages/signin/SignInPage.tsx
Line 156 in a9b6d36
I don't have access to Slack to ask (I sent the request about 3 weeks ago) :)
There was a problem hiding this comment.
@Eskalifer1 You still need to fix the lint, I know that wasn't related to your changes.
With Onyx linting, you can simply pass {canBeMissing: true}
//ie
const [network] = useOnyx(ONYXKEYS.NETWORK, {canBeMissing: true});There was a problem hiding this comment.
Okay, I'll try to do it now, it looks pretty strange, because this code hasn't been touched for a long time, and when I did the PR, these errors were not there)
There was a problem hiding this comment.
Ah yeah. We have a new ESlint rule about onyx and import syntax but it will only check for changed files. Becasue the source code is huge, we can't refactor in one go, so checking lint for changed files will be better
There was a problem hiding this comment.
@hungvu193 Updated PR with eslint and your proposal changes. I apologize if something is wrong, this is my first PR, so I still don't know a lot)
| function SignInPageLoginWrapper(props: SignInPageProps, ref: ForwardedRef<SignInPageRef>) { | ||
| return ( | ||
| <LoginProvider> | ||
| <SignInPageWithRef | ||
| ref={ref} | ||
| // eslint-disable-next-line react/jsx-props-no-spreading | ||
| {...props} | ||
| /> | ||
| </LoginProvider> | ||
| ); | ||
| } | ||
|
|
||
| SignInPageLoginWrapper.displayName = 'SignInPage'; | ||
|
|
||
| const SignInPageLoginWrapperWithRef = forwardRef(SignInPageLoginWrapper); | ||
|
|
There was a problem hiding this comment.
We don't need this one right? This isn't very clear to me because we already forwardRef above:
const SignInPageWithRef = forwardRef(SignInPage);
Then we did it again here:
const SignInPageLoginWrapperWithRef = forwardRef(SignInPageLoginWrapper);How about removing this block of code and just wrapping LoginProider insideSignInPageThemeWrapper?
There was a problem hiding this comment.
I mentioned this here: #60401 (comment)
As for me, the SignInPageThemeWrapper should be responsible only for the theme, as the name suggests, so I added a new Wrapper that is responsible for waking up the login. If you need, I can rework it, just let me know
There was a problem hiding this comment.
Or we can just rename it to SignInPageWrapper, and then add the provider for Login
There was a problem hiding this comment.
I see. Then I think just wrap it inside SignInPage then? Like you mentioned here:
#60401 (comment)
There was a problem hiding this comment.
In my opinion, this will ruin the clean code a bit, because then the rendering of the component and its Wrapper will be mixed. But it's up to you to decide. It seems to me that the best option, if we are not satisfied with another separate wrapper (as I did in the PR), is to rename ThemeWrapper simply to Wrapper, then this new component will be responsible not only for the theme, but also for everything else. The final say is still yours :)
There was a problem hiding this comment.
is to rename ThemeWrapper simply to Wrapper
I think this makes sense. Wdyt?
There was a problem hiding this comment.
I think so. I tried to separate the logic so as not to mix Providers that are responsible for different things with each other, but we can combine everything into one component if it is acceptable
There was a problem hiding this comment.
Cool. I think we only have Provider related to theme before, that's why we named it ThemeProvider, but now we have one more, so renaming it to wrapper will make it cleaner. Let's do it.
There was a problem hiding this comment.
Okay, I'll update the PR now
… component SignInPageWrapper
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2025-04-26.at.23.12.13.movAndroid: mWeb ChromeScreen.Recording.2025-04-26.at.23.13.37.moviOS: NativeScreen.Recording.2025-04-26.at.23.08.47.moviOS: mWeb SafariScreen.Recording.2025-04-26.at.23.07.36.movMacOS: Chrome / SafariScreen.Recording.2025-04-26.at.22.48.38.movMacOS: DesktopScreen.Recording.2025-04-26.at.23.06.37.mov |
|
Hi everyone, should i do something else now? |
|
All good here. In case there is regression you should fix it. As for now, you don't need to do anything |
|
Okay, thx |
|
@Eskalifer1 can you merge main into your branch? That will fix the ESLint error |
|
|
|
@Eskalifer1 Looks like a bad merge 0c930ec Can you check please? |
|
@Valforte Hi, I've merged main to the branch, as you said |
|
@hungvu193 Yes, I updated, for some reason it created this as a separate commit and not as a merge, but I've already fixed it |
|
Does this need a design review? |
|
@dubielzyk-expensify no, ill remove the tag |
|
We have some lintings 🤔 But I don't think it's related to this PR. |
It looks like it, but these files with errors have nothing to do with the login page where the changes were made |
|
can you merge main again? @Eskalifer1 |
|
I checked and those are already fixed in main, so a merge is supposed to fix it |
|
@hungvu193 Updated PR |
|
✋ 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/Valforte in version: 9.1.38-0 🚀
|
|
🚀 Deployed to production by https://github.com/thienlnam in version: 9.1.38-4 🚀
|
Explanation of Change
Fixed Issues
$ #60401
PROPOSAL: #60401 (comment)
Tests
(Same as in Issue)
A few console errors related to canBeMissing are present, but they are irrelevant to this PR.
Offline tests
(Same as in Issue)
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.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
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