From 0ac181dd430d73ef58c90cb4056c95ae05f28215 Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Mon, 9 Nov 2020 11:50:54 +0800 Subject: [PATCH] Add useSelect dependencies --- .../src/components/inserter/quick-inserter.js | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/packages/block-editor/src/components/inserter/quick-inserter.js b/packages/block-editor/src/components/inserter/quick-inserter.js index 72062353d3a987..0fe60bc55b9197 100644 --- a/packages/block-editor/src/components/inserter/quick-inserter.js +++ b/packages/block-editor/src/components/inserter/quick-inserter.js @@ -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 ) {