Components: refactor RangeControl to pass exhaustive-deps#44271
Merged
Components: refactor RangeControl to pass exhaustive-deps#44271
RangeControl to pass exhaustive-deps#44271Conversation
BorderControl to pass exhaustive-depsRangeControl to pass exhaustive-deps
Contributor
|
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 🙏 |
44 tasks
aaronrobertshaw
approved these changes
Sep 21, 2022
Contributor
aaronrobertshaw
left a comment
There was a problem hiding this comment.
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-depsResizeBox to pass exhaustive-deps
ResizeBox to pass exhaustive-depsRangeControl to pass exhaustive-deps
aaronrobertshaw
added a commit
that referenced
this pull request
Sep 23, 2022
This reflects the changes made in #44271 for the RangeControl.
aaronrobertshaw
added a commit
that referenced
this pull request
Oct 3, 2022
This reflects the changes made in #44271 for the RangeControl.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Updates the
RangeControlcomponent to satisfy theexhaustive-depseslint ruleWhy?
Part of the effort in #41166 to apply
exhuastive-depsto the Components packageHow?
tooltip.tsx:inputRefshould 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:setInternalStateis declared by running theuseControlledStatehook. 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 #44161RangeControlcomponent is showing/hiding theTooltipcomponent on focus/blur.useDebouncedHoverInteractionhook was simply out of date and can be deleted without causing any consequencesonShowTooltipandonHideTooltipprops fromInputRangePropswere also deleted since they were only used when passed to theuseDebouncedHoverInteractionprop, and are therefore not used anymoreTesting Instructions
npx eslint --rule 'react-hooks/exhaustive-deps: warn' packages/components/src/range-control