Skip to content

Commit 868aaf1

Browse files
chad1008ciampo
andauthored
Components: refactor AlignmentMatrixControl to pass exhaustive-deps (#41167)
* destructure `compsite.setCurrentId` outside of effect to avoid a loop. Update dependency array * Components: update changelog * Update packages/components/CHANGELOG.md * Update packages/components/CHANGELOG.md * Update packages/components/CHANGELOG.md Co-authored-by: Marco Ciampini <marco.ciampo@gmail.com>
1 parent 20f6ca5 commit 868aaf1

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

packages/components/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### Internal
66

7+
- `AlignmentMatrixControl` updated to satisfy `react/exhuastive-deps` eslint rule ([#41167](https://github.com/WordPress/gutenberg/pull/41167))
78
- `CheckboxControl`: Add unit tests ([#41165](https://github.com/WordPress/gutenberg/pull/41165)).
89

910
## 19.11.0 (2022-05-18)

packages/components/src/alignment-matrix-control/index.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,13 @@ export default function AlignmentMatrixControl( {
5353
onChange( nextValue );
5454
};
5555

56+
const { setCurrentId } = composite;
57+
5658
useEffect( () => {
5759
if ( typeof value !== 'undefined' ) {
58-
composite.setCurrentId( getItemId( baseId, value ) );
60+
setCurrentId( getItemId( baseId, value ) );
5961
}
60-
}, [ value, composite.setCurrentId ] );
62+
}, [ value, setCurrentId, baseId ] );
6163

6264
const classes = classnames(
6365
'component-alignment-matrix-control',

0 commit comments

Comments
 (0)