Skip to content

Commit

Permalink
Change clientNavigation config to clientNavigationDisabled
Browse files Browse the repository at this point in the history
  • Loading branch information
DAreRodz committed Feb 8, 2024
1 parent 2eb4c1b commit 4480404
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/block-library/src/query/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
if ( $attributes['disableNavigation'] ) {
wp_interactivity_config(
'core/router',
array( 'clientNavigation' => false )
array( 'clientNavigationDisabled' => true )
);
}
?>
Expand Down
2 changes: 1 addition & 1 deletion packages/interactivity-router/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
8 changes: 4 additions & 4 deletions packages/interactivity-router/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}

Expand Down Expand Up @@ -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 ) ) {
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/specs/interactivity/router-navigate.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
} ) => {
Expand Down

0 comments on commit 4480404

Please sign in to comment.