diff --git a/packages/block-library/src/query/index.php b/packages/block-library/src/query/index.php index e3fcffc07af973..1a536dd3dcd98f 100644 --- a/packages/block-library/src/query/index.php +++ b/packages/block-library/src/query/index.php @@ -138,7 +138,7 @@ function block_core_query_disable_enhanced_pagination( $parsed_block ) { if ( isset( $dirty_enhanced_queries[ $block['attrs']['queryId'] ] ) ) { // Disable navigation in the router store config. - wp_interactivity_config( 'core/router', array( 'clientNavigation' => false ) ); + wp_interactivity_config( 'core/router', array( 'clientNavigationDisabled' => true ) ); $dirty_enhanced_queries[ $block['attrs']['queryId'] ] = null; } diff --git a/packages/e2e-tests/plugins/interactive-blocks/router-navigate/render.php b/packages/e2e-tests/plugins/interactive-blocks/router-navigate/render.php index 22912db30a7e8c..4abcee3de2c399 100644 --- a/packages/e2e-tests/plugins/interactive-blocks/router-navigate/render.php +++ b/packages/e2e-tests/plugins/interactive-blocks/router-navigate/render.php @@ -12,7 +12,7 @@ if ( $attributes['disableNavigation'] ) { wp_interactivity_config( 'core/router', - array( 'clientNavigation' => false ) + array( 'clientNavigationDisabled' => true ) ); } ?> diff --git a/packages/interactivity-router/CHANGELOG.md b/packages/interactivity-router/CHANGELOG.md index ea7069bad2f62e..8931100bbd4c3b 100644 --- a/packages/interactivity-router/CHANGELOG.md +++ b/packages/interactivity-router/CHANGELOG.md @@ -4,7 +4,7 @@ ### New Features -- Add the `clientNavigation` option to the `core/router` config. ([58749](https://github.com/WordPress/gutenberg/pull/58749)) +- Add the `clientNavigationDisabled` option to the `core/router` config. ([58749](https://github.com/WordPress/gutenberg/pull/58749)) ## 1.0.0 (2024-01-24) diff --git a/packages/interactivity-router/src/index.js b/packages/interactivity-router/src/index.js index 0e7a930141ecfb..697729ff7a4a83 100644 --- a/packages/interactivity-router/src/index.js +++ b/packages/interactivity-router/src/index.js @@ -133,8 +133,8 @@ export const { state, actions } = store( 'core/router', { * @return {Promise} Promise that resolves once the navigation is completed or aborted. */ *navigate( href, options = {} ) { - const { clientNavigation = true } = getConfig( 'core/router' ); - if ( ! clientNavigation ) { + const { clientNavigationDisabled } = getConfig( 'core/router' ); + if ( clientNavigationDisabled ) { yield forcePageReload( href ); } @@ -225,8 +225,8 @@ export const { state, actions } = store( 'core/router', { * fetching the requested URL. */ prefetch( url, options = {} ) { - const { clientNavigation = true } = getConfig( 'core/router' ); - if ( ! clientNavigation ) return; + const { clientNavigationDisabled } = getConfig( 'core/router' ); + if ( clientNavigationDisabled ) return; const pagePath = getPagePath( url ); if ( options.force || ! pages.has( pagePath ) ) { diff --git a/test/e2e/specs/interactivity/router-navigate.spec.ts b/test/e2e/specs/interactivity/router-navigate.spec.ts index 4eea952feadfb3..fafa31341f463e 100644 --- a/test/e2e/specs/interactivity/router-navigate.spec.ts +++ b/test/e2e/specs/interactivity/router-navigate.spec.ts @@ -169,7 +169,7 @@ test.describe( 'Router navigate', () => { resolver!(); } ); - test( 'should force a page reload when the `clientNavigation` config is set to false', async ( { + test( 'should force a page reload when the `clientNavigationDisabled` config is set to true', async ( { page, interactivityUtils: utils, } ) => {