-
Notifications
You must be signed in to change notification settings - Fork 4.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: tooltip component from classical to functional with hooks #27682
Conversation
Size Change: -308 B (0%) Total Size: 1.28 MB
ℹ️ View Unchanged
|
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.
Nice work here @grzim, it works really well in testing.
I only had a few smaller comments that should be fairly easy to address.
I restarted the tests as there were unrelated failures relating to an issue with axe-core (an accessibility testing framework in our e2e tests).
* | ||
* @type {boolean} | ||
*/ | ||
const [ isMouseDown, setIsMouseDown ] = useState( false ); |
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 wonder a ref could be considered here as the previous implementation didn't use state for this value, instead preferring a property.
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.
Are you sure ref would be a better option here? My rule of thumb is to avoid mutable values when it is possible
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.
State will trigger re-renders where a ref wouldn't, but probably not a massive issue in this situation.
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! Thanks for your patience waiting for the tests to pass. Got there in the end.
Description
Regarding #22890 "Refactor all React class components to functional components using hooks" this pull request contains a rewritten tooltip
This is a reupload of #27353 . Due to some problems with merging I had to make a new pull request.
How has this been tested?
Changes tested visually and with a set of unit tests that were adjusted to work with the functional component.
Types of changes
Refactor
Checklist: