diff --git a/packages/block-library/src/navigation/edit/index.js b/packages/block-library/src/navigation/edit/index.js index c6ab2f38d0e98a..486fc44c82e1d1 100644 --- a/packages/block-library/src/navigation/edit/index.js +++ b/packages/block-library/src/navigation/edit/index.js @@ -2,6 +2,7 @@ * External dependencies */ import classnames from 'classnames'; +import noop from 'lodash'; /** * WordPress dependencies @@ -109,12 +110,19 @@ function Navigation( { layout: { justifyContent, orientation = 'horizontal' } = {}, } = attributes; - const [ areaMenu, setAreaMenu ] = useEntityProp( - 'root', - 'navigationArea', - 'navigation', - navigationArea - ); + let areaMenu, + setAreaMenu = noop; + // Navigation areas are deprecated and on their way out. Let's not perform + // the request unless we're in an environment where the endpoint exists. + if ( process.env.GUTENBERG_PHASE === 2 ) { + // eslint-disable-next-line react-hooks/rules-of-hooks + [ areaMenu, setAreaMenu ] = useEntityProp( + 'root', + 'navigationArea', + 'navigation', + navigationArea + ); + } const navigationAreaMenu = areaMenu === 0 ? undefined : areaMenu;