-
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
Components: refactor RangeControl
to pass exhaustive-deps
#44271
Conversation
BorderControl
to pass exhaustive-deps
RangeControl
to pass exhaustive-deps
Hey @mirka @aaronrobertshaw and @tyxla , @chad1008 and I paired on this PR and therefore would appreciate if you could take a look and review it! Thanks 🙏 |
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.
Thanks for the ping to review this one 👍
I'll need to remove the useDebouncedHoverInteraction
custom hook and reflect these same changes for the new SliderControl component in #42315.
As for this PR, it tests well for me in the storybook and editor.
✅ No build or type errors
✅ No general linting errors
✅ No exhaustive-deps
warnings for the RangeControl
✅ RangeControl unit tests pass
✅ Storybook: RangeControl and docs function correctly
✅ RangeControls in the editor work as expected
RangeControl
to pass exhaustive-deps
ResizeBox
to pass exhaustive-deps
ResizeBox
to pass exhaustive-deps
RangeControl
to pass exhaustive-deps
This reflects the changes made in #44271 for the RangeControl.
This reflects the changes made in #44271 for the RangeControl.
What?
Updates the
RangeControl
component to satisfy theexhaustive-deps
eslint ruleWhy?
Part of the effort in #41166 to apply
exhuastive-deps
to the Components packageHow?
tooltip.tsx
:inputRef
should always be a ref object passed in by the consumer, even React can't tell that it is. As a ref, it'll stay stable and a safe dependency.utils.ts
:setInternalState
is declared by running theuseControlledState
hook. I didn't notice any adverse effects to this new dependency, and the underlying function is also being memoized in UnitControl: fix exhaustive-deps warnings #44161RangeControl
component is showing/hiding theTooltip
component on focus/blur.useDebouncedHoverInteraction
hook was simply out of date and can be deleted without causing any consequencesonShowTooltip
andonHideTooltip
props fromInputRangeProps
were also deleted since they were only used when passed to theuseDebouncedHoverInteraction
prop, and are therefore not used anymoreTesting Instructions
npx eslint --rule 'react-hooks/exhaustive-deps: warn' packages/components/src/range-control