From 16237112e98f2b3f1db6179026f7a0d469b42ee7 Mon Sep 17 00:00:00 2001 From: Jerry Jones Date: Tue, 14 Jan 2025 09:33:03 -0600 Subject: [PATCH] Navigation Link UI: Remove onClose from onSelectBlock (#67760) onSelectBlock was being called after from the QuickInserter even if the link ui had already been closed. This results in some weird states due to the function containing old states. There have been updates to this flow around closing the link ui since the code was originally written, and the onClose should be handled by the popover already. Co-authored-by: jeryj Co-authored-by: Mamaduka Co-authored-by: darnado --- packages/block-library/src/navigation-link/link-ui.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/packages/block-library/src/navigation-link/link-ui.js b/packages/block-library/src/navigation-link/link-ui.js index a6c709f260b037..47a8cb99ffdb24 100644 --- a/packages/block-library/src/navigation-link/link-ui.js +++ b/packages/block-library/src/navigation-link/link-ui.js @@ -78,7 +78,7 @@ export function getSuggestionsQuery( type, kind ) { } } -function LinkUIBlockInserter( { clientId, onBack, onSelectBlock } ) { +function LinkUIBlockInserter( { clientId, onBack } ) { const { rootBlockClientId } = useSelect( ( select ) => { const { getBlockRootClientId } = select( blockEditorStore ); @@ -140,7 +140,6 @@ function LinkUIBlockInserter( { clientId, onBack, onSelectBlock } ) { prioritizePatterns={ false } selectBlockOnInsert hasSearch={ false } - onSelect={ onSelectBlock } /> ); @@ -203,10 +202,6 @@ function UnforwardedLinkUI( props, ref ) { `link-ui-link-control__description` ); - // Selecting a block should close the popover and also remove the (previously) automatically inserted - // link block so that the newly selected block can be inserted in its place. - const { onClose: onSelectBlock } = props; - return ( ) }