Skip to content

Persist username across login/register form toggle - #50

Draft
mterczynski with Copilot wants to merge 2 commits into
mainfrom
copilot/persist-user-name-input
Draft

Persist username across login/register form toggle#50
mterczynski with Copilot wants to merge 2 commits into
mainfrom
copilot/persist-user-name-input

Conversation

Copilot AI commented Feb 25, 2026

Copy link
Copy Markdown
Contributor

When switching between the login and register forms, the username field was reset because each form managed its own local name state — unmounting one form discarded the value before the other mounted.

Changes

  • Lift name state to AuthScreen: AuthScreen now owns const [name, setName] = useState("") and passes it down as props, keeping the value alive across form switches.
  • LoginUserForm / RegisterUserForm: Replaced local name state with name: string / setName props.
// AuthScreen.tsx
const [name, setName] = useState("");

// passed to both forms:
<LoginUserForm onLogin={...} name={name} setName={setName} />
<RegisterUserForm onRegister={...} name={name} setName={setName} />
Original prompt

This section details on the original issue you should resolve

<issue_title>Persist user name when switching from login to register or vice versa</issue_title>
<issue_description>The user name input field should not be cleared when switching between the two tabs (typically using the link below the login/register form)</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: mterczynski <27309340+mterczynski@users.noreply.github.com>
Copilot AI changed the title [WIP] Persist user name when switching between login and register Persist username across login/register form toggle Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Persist user name when switching from login to register or vice versa

2 participants