Skip to content

Commit

Permalink
Add useSelect dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
talldan committed Nov 9, 2020
1 parent e707a30 commit 0ac181d
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions packages/block-editor/src/components/inserter/quick-inserter.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,19 @@ export default function QuickInserter( {
[ filterValue, patterns ]
);

const { setInserterIsOpened, blockIndex } = useSelect( ( select ) => {
const { getSettings, getBlockIndex } = select( 'core/block-editor' );
return {
setInserterIsOpened: getSettings()
.__experimentalSetIsInserterOpened,
blockIndex: getBlockIndex( clientId, rootClientId ),
};
}, [] );
const { setInserterIsOpened, blockIndex } = useSelect(
( select ) => {
const { getSettings, getBlockIndex } = select(
'core/block-editor'
);
return {
setInserterIsOpened: getSettings()
.__experimentalSetIsInserterOpened,
blockIndex: getBlockIndex( clientId, rootClientId ),
};
},
[ clientId, rootClientId ]
);

useEffect( () => {
if ( setInserterIsOpened ) {
Expand Down

0 comments on commit 0ac181d

Please sign in to comment.