Skip to content

Commit

Permalink
Memoize useSelect callback function
Browse files Browse the repository at this point in the history
Co-Authored-By: Zebulan Stanphill <[email protected]>
  • Loading branch information
talldan and ZebulanStanphill authored Apr 6, 2020
1 parent 81d8cf6 commit 6683673
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ import BlockActions from '../block-actions';
import BlockMover from '../block-mover';

export default function BlockNavigationToolbar() {
const blockClientIds = useSelect( ( select ) =>
select( 'core/block-editor' ).getSelectedBlockClientIds()
const blockClientIds = useSelect(
( select ) => select( 'core/block-editor' ).getSelectedBlockClientIds(),
[]
);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ import { useDispatch, useSelect } from '@wordpress/data';
import { __ } from '@wordpress/i18n';

export default function NavigationStructurePanel( { blocks } ) {
const selectedBlockClientIds = useSelect( ( select ) =>
select( 'core/block-editor' ).getSelectedBlockClientIds()
const blockClientIds = useSelect(
( select ) => select( 'core/block-editor' ).getSelectedBlockClientIds(),
[]
);

const { selectBlock } = useDispatch( 'core/block-editor' );
Expand Down

0 comments on commit 6683673

Please sign in to comment.