diff --git a/packages/block-editor/src/components/link-control/index.js b/packages/block-editor/src/components/link-control/index.js index b807adcbbd880..b526998596478 100644 --- a/packages/block-editor/src/components/link-control/index.js +++ b/packages/block-editor/src/components/link-control/index.js @@ -148,6 +148,10 @@ function LinkControl( { const currentInputIsEmpty = ! currentInputValue?.trim()?.length; + const { createPage, isCreatingPage, errorMessage } = useCreatePage( + createSuggestion + ); + useEffect( () => { if ( forceIsEditingLink !== undefined && @@ -185,7 +189,7 @@ function LinkControl( { nextFocusTarget.focus(); isEndingEditWithFocus.current = false; - }, [ isEditingLink ] ); + }, [ isEditingLink, isCreatingPage ] ); useEffect( () => { /** @@ -217,10 +221,6 @@ function LinkControl( { setIsEditingLink( false ); } - const { createPage, isCreatingPage, errorMessage } = useCreatePage( - createSuggestion - ); - const handleSelectSuggestion = ( updatedValue ) => { onChange( { ...updatedValue,