-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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(ui): migrate UserInfo
to functional component
#11793
refactor(ui): migrate UserInfo
to functional component
#11793
Conversation
- mostly straightforward state refactor - plus refactor `componentDidMount` to `useEffect` - also remove the deprecated usage of BasePage - BasePage wasn't even used in the component (or at least not currently), so just the `extends` and typings were removed, effectively - BasePage is a deprecated usage of `react-router`'s private context before React made context an official API (it's quite old) - UserInfo did not use any routing primitives - manually tested and works the same as it did before Signed-off-by: Anton Gilgur <[email protected]>
- these are not used by anything at this time - searched the codebase and found 0 references Signed-off-by: Anton Gilgur <[email protected]>
Signed-off-by: Anton Gilgur <[email protected]>
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.
Can we merge similar PRs?
At your previous request, I did. You picked the odd PR out. #11791 has 12 components and 27 files changed. They are all pure functional components or have very minimal state. This PR has an effect, unlike all the rest in #11791. (I also wrote it today whereas #11791 is from yesterday) Per my opening comment, I split out #11794 from this PR as #11794 is substantially more complex than any of the rest (and also took me by far the longest to rewrite). It also follows the structure of an older PR closely for ease of review. In any case, all 3 pass CI as there are significantly less flakes after #11753. They all merge cleanly as well. So at this point, it would also be unnecessary extra work to merge them together, especially when that makes the diff much worse and harder to review as well. |
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.
I've doublely checked functionality.
I should note BasePage
can be removed finally after both report page and workflow-list page are migrated as @agilgur5 stated.
Refs:
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
|
Partial fix for #9810
Partial fix for #11740
Motivation
Use newer, modern functional components compatible with hooks instead of legacy class-based components
Use newer, modern async/await syntax instead of Promise chains
also remove a deprecated usage of
BasePage
BasePage
is a deprecated usage ofreact-router
's private context before React made context an official API (it's quite old)react-router-dom
as the old, private context no longer exists in new versionsReports
to functional component and split files #11794)Modifications
mostly straightforward state refactor from
this.state
touseState
componentDidMount
touseEffect
remove deprecated
BasePage
extends
and typingsUserInfo
(or at least not currently), so just removed referencesUserInfo
plus remove unused
BasePage
methodsVerification
Notes for Reviewers
Turn on "ignore whitespace" to make the diff much simpler to read