Skip to content

Commit

Permalink
Components: refactor BorderControl to pass exhaustive-deps (#41259)
Browse files Browse the repository at this point in the history
* update dependency arrays for react/exhuastive-deps

* BorderControl: update changelog

* remove extra whitespace
  • Loading branch information
chad1008 authored May 24, 2022
1 parent d0faa07 commit eca485f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Internal

- `AlignmentMatrixControl` updated to satisfy `react/exhuastive-deps` eslint rule ([#41167](https://github.com/WordPress/gutenberg/pull/41167))
- `BorderControl` updated to satisfy `react/exhuastive-deps` eslint rule ([#41259](https://github.com/WordPress/gutenberg/pull/41259))
- `CheckboxControl`: Add unit tests ([#41165](https://github.com/WordPress/gutenberg/pull/41165)).
- `BorderBoxControl`: fix some layout misalignments, especially for RTL users ([#41254](https://github.com/WordPress/gutenberg/pull/41254)).

Expand Down
10 changes: 8 additions & 2 deletions packages/components/src/border-control/border-control/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export function useBorderControl(

onChange( newBorder );
},
[ onChange, shouldSanitizeBorder, sanitizeBorder ]
[ onChange, shouldSanitizeBorder ]
);

const onWidthChange = useCallback(
Expand Down Expand Up @@ -97,7 +97,13 @@ export function useBorderControl(

onBorderChange( updatedBorder );
},
[ border, hadPreviousZeroWidth, onBorderChange ]
[
border,
hadPreviousZeroWidth,
colorSelection,
styleSelection,
onBorderChange,
]
);

const onSliderChange = useCallback(
Expand Down

0 comments on commit eca485f

Please sign in to comment.