Skip to content

db-console: convert login components to functional components#164534

Merged
trunk-io[bot] merged 1 commit intocockroachdb:masterfrom
jasonlmfong:jf/console-login-func-2
Mar 4, 2026
Merged

db-console: convert login components to functional components#164534
trunk-io[bot] merged 1 commit intocockroachdb:masterfrom
jasonlmfong:jf/console-login-func-2

Conversation

@jasonlmfong
Copy link
Member

Convert the following class components to functional style:

  • PasswordLoginForm:
    1. class state → useState for username and password
    2. handleUpdate methods simplified to direct setter references
  • LoginPage:
    1. componentDidUpdate redirect → useEffect with loggedInUser dep
    2. renderError kept as inner function
  • RequireLogin:
    1. componentDidMount + componentDidUpdate → single useEffect
    2. connect + withRouter → useSelector + useHistory + useLocation

Epic: CRDB-58145
Release note: None

@trunk-io
Copy link
Contributor

trunk-io bot commented Feb 27, 2026

😎 Merged directly without going through the merge queue, as the queue was empty and the PR was up to date with the target branch - details.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

const LoginPageConnected: React.FC<RouteComponentProps> = ({
location,
history,
match,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

match seems unused

Convert the following class components to functional style:
- PasswordLoginForm:
    1. class state → useState for username and password
    2. handleUpdate methods simplified to direct setter references
- LoginPage:
    1. componentDidUpdate redirect → useEffect with loggedInUser dep
    2. renderError kept as inner function
- RequireLogin:
    1. componentDidMount + componentDidUpdate → single useEffect
    2. connect + withRouter → useSelector + useHistory + useLocation

Epic: CRDB-58145
Release note: None
@jasonlmfong jasonlmfong force-pushed the jf/console-login-func-2 branch from 52855ad to dcbad1e Compare March 4, 2026 14:24
@jasonlmfong
Copy link
Member Author

/trunk merge

TFTR!

@trunk-io trunk-io bot merged commit 330f115 into cockroachdb:master Mar 4, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants