Skip to content

Commit

Permalink
Components: refactor NavigationItem to pass exhaustive-deps (#41639)
Browse files Browse the repository at this point in the history
* NavigationItem: add missing deps to `useNavigationTreeItem` `useEffect`

* NavigationItem: memoize `addItem` with `useCallback`

* NavigationItem: memoize `removeItem` with `useCallback`

* NavigationItem: add remaining useEffect deps (non-memoized)

* NavigationItem: update changelog

* revert previous changes and ignore exhuastive deps for now
  • Loading branch information
chad1008 authored Jun 28, 2022
1 parent e6a4fe4 commit 52e2742
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
- `CustomGradientPicker`: Refactor away from Lodash ([#41901](https://github.com/WordPress/gutenberg/pull/41901/)).
- `SegmentedControl`: Refactor away from `_.values()` ([#41905](https://github.com/WordPress/gutenberg/pull/41905/)).
- `DimensionControl`: Refactor docs away from `_.partialRight()` ([#41909](https://github.com/WordPress/gutenberg/pull/41909/)).
- `NavigationItem` updated to ignore `react/exhuastive-deps` eslint rule ([#41639](https://github.com/WordPress/gutenberg/pull/41639)).

## 19.13.0 (2022-06-15)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,7 @@ export const useNavigationTreeItem = ( itemId, props ) => {
return () => {
removeItem( itemId );
};
// Ignore exhaustive-deps rule for now. See https://github.com/WordPress/gutenberg/pull/41639
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [ activeMenu, search ] );
};

0 comments on commit 52e2742

Please sign in to comment.