Skip to content
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

[HOLD for payment 2024-08-14] [$250] Login - Entered email is cleared on the login page if the window is resized to small size #46204

Closed
1 of 6 tasks
lanitochka17 opened this issue Jul 25, 2024 · 19 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor

Comments

@lanitochka17
Copy link

lanitochka17 commented Jul 25, 2024

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.0.12-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Issue reported by: Applause - Internal Team

Action Performed:

  1. Navigate to https://staging.new.expensify.com/
  2. Log out
  3. Enter any email address
  4. Resize the browser windows to small
  5. Resize it to the original size

Expected Result:

Entered email should still be in the field

Actual Result:

Entered email is cleared on the login page if the window is resized to small size

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6552628_1721911184187.bandicam_2024-07-25_14-34-08-742.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0124dcdbeaf4f51b56
  • Upwork Job ID: 1818028181753125282
  • Last Price Increase: 2024-07-29
Issue OwnerCurrent Issue Owner: @sakluger
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Jul 25, 2024
Copy link

melvin-bot bot commented Jul 25, 2024

Triggered auto assignment to @sakluger (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

@lanitochka17
Copy link
Author

@sakluger FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

@lanitochka17
Copy link
Author

We think that this bug might be related to #vip-vsp

@bernhardoj
Copy link
Contributor

Proposal

Please re-state the problem that we are trying to solve in this issue.

The entered email address is cleared when resizing window.

What is the root cause of that problem?

The login form is wrapped with SignInPageLayout and the login state is inside LoginForm.

<SignInPageLayout
welcomeHeader={welcomeHeader}
welcomeText={welcomeText}
shouldShowWelcomeHeader={shouldShowWelcomeHeader || !shouldUseNarrowLayout}
shouldShowWelcomeText={shouldShowWelcomeText}
ref={signInPageLayoutRef}
navigateFocus={navigateFocus}
>
{/* LoginForm must use the isVisible prop. This keeps it mounted, but visually hidden
so that password managers can access the values. Conditionally rendering this component will break this feature. */}
<LoginForm
ref={loginFormRef}
isVisible={shouldShowLoginForm}
blurOnSubmit={account?.validated === false}
scrollPageToTop={signInPageLayoutRef.current?.scrollPageToTop}
/>

SignInPageLayout conditionally render the layout structure based on the screen size.

return (
<View style={containerStyles}>
{!shouldUseNarrowLayout ? (
<View style={contentContainerStyles}>
<ScrollView
keyboardShouldPersistTaps="handled"
style={[styles.signInPageLeftContainerWide, styles.flex1]}
contentContainerStyle={[styles.flex1]}
>
<SignInPageContent
welcomeHeader={welcomeHeader}
welcomeText={welcomeText}
shouldShowWelcomeText={shouldShowWelcomeText}
shouldShowWelcomeHeader={shouldShowWelcomeHeader}
>
{children}
</SignInPageContent>
</ScrollView>
<ScrollView
style={[styles.flex1, StyleUtils.getBackgroundColorStyle(theme.signInPage)]}
contentContainerStyle={[styles.flex1]}
ref={scrollViewRef}
>
<View style={[styles.flex1]}>
<View style={styles.signInPageHeroCenter}>
<BackgroundImage
isSmallScreen={false}
pointerEvents="none"
width={variables.signInHeroBackgroundWidth}
transitionDuration={CONST.BACKGROUND_IMAGE_TRANSITION_DURATION}
/>
</View>
<View>
<View style={[styles.t0, styles.l0, styles.h100, styles.pAbsolute, styles.signInPageGradient]}>
<ImageSVG
src={SignInGradient}
height="100%"
preserveAspectRatio="none"
/>
</View>
<View
style={[
styles.alignSelfCenter,
StyleUtils.getMaximumWidth(variables.signInContentMaxWidth),
isMediumScreenWidth ? styles.ph10 : {},
isLargeScreenWidth ? styles.ph25 : {},
]}
>
<SignInPageHero
customHeadline={customHeadline}
customHeroBody={customHeroBody}
/>
<Footer navigateFocus={navigateFocus} />
</View>
</View>
</View>
</ScrollView>
</View>
) : (
<ScrollView
contentContainerStyle={scrollViewStyles}
keyboardShouldPersistTaps="handled"
ref={scrollViewRef}
>
<View
style={[
styles.flex1,
styles.flexColumn,
Browser.isMobileSafari() ? styles.overflowHidden : {},
StyleUtils.getMinimumHeight(backgroundImageHeight),
StyleUtils.getSignInBgStyles(theme),
]}
>
<View style={[styles.pAbsolute, styles.w100, StyleUtils.getHeight(backgroundImageHeight), StyleUtils.getBackgroundColorStyle(theme.highlightBG)]}>
<BackgroundImage
isSmallScreen
pointerEvents="none"
width={variables.signInHeroBackgroundWidthMobile}
transitionDuration={CONST.BACKGROUND_IMAGE_TRANSITION_DURATION}
/>
</View>
<SignInPageContent
welcomeHeader={welcomeHeader}
welcomeText={welcomeText}
shouldShowWelcomeText={shouldShowWelcomeText}
shouldShowWelcomeHeader={shouldShowWelcomeHeader}
>
{children}
</SignInPageContent>
</View>
<View style={[styles.flex0]}>
<Footer navigateFocus={navigateFocus} />
</View>
</ScrollView>
)}
</View>

So, when the structure is different, the LoginForm is remounted, losing all of its state.

What changes do you think we should make in order to solve the problem?

Move up the login state from BaseLoginForm to SignInPage, then pass the state down to BaseLoginForm.

const [login, setLogin] = useState(() => Str.removeSMSDomain(credentials?.login ?? ''));

<LoginForm login={login} updateLogin={setLogin} ... />

@FitseTLT
Copy link
Contributor

Proposal

Please re-state the problem that we are trying to solve in this issue.

Login - Entered email is cleared on the login page if the window is resized to small size

What is the root cause of that problem?

The login is saved in login state of BaseLoginForm but the login form is children of SignInPageLayout which displays it's children withdifferent layout according to the window size and doing so it conditionally returns two instances of the login form and when the window size changes it unmounts the prev login form and the login data disappears along with it.
But the same happens for ValidateCodeForm too.

What changes do you think we should make in order to solve the problem?

We should to take all the states of both BaseLoginForm

const [login, setLogin] = useState(() => Str.removeSMSDomain(credentials?.login ?? ''));
const [formError, setFormError] = useState<string | undefined>();

and BaseValidateCodeForm
const [formError, setFormError] = useState<FormError>({});
const [validateCode, setValidateCode] = useState(credentials?.validateCode ?? '');
const [twoFactorAuthCode, setTwoFactorAuthCode] = useState('');
const [timeRemaining, setTimeRemaining] = useState(30);
const [recoveryCode, setRecoveryCode] = useState('');
const [needToClearError, setNeedToClearError] = useState<boolean>(!!account?.errors);

up into SigninPage and pass the states and setters of the states down to the two login and validate code form components
Of course we can also use Context instead of state if needed.

What alternative solutions did you explore? (Optional)

@melvin-bot melvin-bot bot added the Overdue label Jul 29, 2024
@sakluger sakluger added the External Added to denote the issue can be worked on by a contributor label Jul 29, 2024
@melvin-bot melvin-bot bot changed the title Login - Entered email is cleared on the login page if the window is resized to small size [$250] Login - Entered email is cleared on the login page if the window is resized to small size Jul 29, 2024
Copy link

melvin-bot bot commented Jul 29, 2024

Job added to Upwork: https://www.upwork.com/jobs/~0124dcdbeaf4f51b56

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Jul 29, 2024
Copy link

melvin-bot bot commented Jul 29, 2024

Triggered auto assignment to Contributor-plus team member for initial proposal review - @mananjadhav (External)

@melvin-bot melvin-bot bot removed the Overdue label Jul 29, 2024
@mananjadhav
Copy link
Collaborator

Both the proposals identify the root cause correctly, and I think we should use the state instead of Context.

Considering the proposals are on similar lines, @bernhardoj's proposal looks good to me.

🎀 👀 🎀 C+ reviewed.

Copy link

melvin-bot bot commented Aug 1, 2024

Triggered auto assignment to @francoisl, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@melvin-bot melvin-bot bot removed the Help Wanted Apply this label when an issue is open to proposals by contributors label Aug 1, 2024
@melvin-bot melvin-bot bot added Reviewing Has a PR in review Weekly KSv2 and removed Daily KSv2 labels Aug 2, 2024
@melvin-bot melvin-bot bot added Weekly KSv2 and removed Weekly KSv2 labels Aug 2, 2024
@bernhardoj
Copy link
Contributor

PR is ready

cc: @mananjadhav

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Aug 7, 2024
@melvin-bot melvin-bot bot changed the title [$250] Login - Entered email is cleared on the login page if the window is resized to small size [HOLD for payment 2024-08-14] [$250] Login - Entered email is cleared on the login page if the window is resized to small size Aug 7, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Aug 7, 2024
Copy link

melvin-bot bot commented Aug 7, 2024

Reviewing label has been removed, please complete the "BugZero Checklist".

Copy link

melvin-bot bot commented Aug 7, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.17-2 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2024-08-14. 🎊

For reference, here are some details about the assignees on this issue:

  • @mananjadhav requires payment through NewDot Manual Requests
  • @bernhardoj requires payment through NewDot Manual Requests

Copy link

melvin-bot bot commented Aug 7, 2024

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@mananjadhav] The PR that introduced the bug has been identified. Link to the PR:
  • [@mananjadhav] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
  • [@mananjadhav] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
  • [@mananjadhav] Determine if we should create a regression test for this bug.
  • [@mananjadhav] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@sakluger] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@mananjadhav
Copy link
Collaborator

@sakluger This one's also ready for payout. I know we've had this state setup since a very long time. We had also closed this issue once. I don't think we have an offending PR here as this only occurs when one resizes the window. Considering this I also don't think we need a regression test for this one.

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Aug 14, 2024
Copy link

melvin-bot bot commented Aug 14, 2024

Payment Summary

Upwork Job

BugZero Checklist (@sakluger)

  • I have verified the correct assignees and roles are listed above and updated the neccesary manual offers
  • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/1818028181753125282/hired)
  • I have paid out the Upwork contracts or cancelled the ones that are incorrect
  • I have verified the payment summary above is correct

@sakluger
Copy link
Contributor

Thanks @mananjadhav!

@JmillsExpensify we can use the payment summary in the comment above.

@bernhardoj
Copy link
Contributor

Requested in ND.

@JmillsExpensify
Copy link

$250 approved for @mananjadhav

@JmillsExpensify
Copy link

$250 approved for @bernhardoj

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 External Added to denote the issue can be worked on by a contributor
Projects
No open projects
Archived in project
Development

No branches or pull requests

7 participants