Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default function EnhancedPaginationModal( {
if ( hasBlocksFromPlugins ) {
notice =
__(
'Currently, avoiding full page reloads is not possible when blocks from plugins are present inside the Query block.'
'Currently, avoiding full page reloads is not possible when non-interactive or non-clientNavigation compatible blocks from plugins are present inside the Query block.'
) +
' ' +
notice;
Expand Down
25 changes: 23 additions & 2 deletions packages/block-library/src/query/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import { useMemo } from '@wordpress/element';
import { store as coreStore } from '@wordpress/core-data';
import { store as blockEditorStore } from '@wordpress/block-editor';
import { decodeEntities } from '@wordpress/html-entities';
import { cloneBlock, store as blocksStore } from '@wordpress/blocks';
import {
cloneBlock,
getBlockSupport,
store as blocksStore,
} from '@wordpress/blocks';

/** @typedef {import('@wordpress/blocks').WPBlockVariation} WPBlockVariation */

Expand Down Expand Up @@ -375,7 +379,24 @@ export const useUnsupportedBlocks = ( clientId ) => {
getClientIdsOfDescendants( clientId ).forEach(
( descendantClientId ) => {
const blockName = getBlockName( descendantClientId );
if ( ! blockName.startsWith( 'core/' ) ) {
/*
* Client side navigation can be true in two states:
* - supports.interactivity = true;
* - supports.interactivity.clientNavigation = true;
*/
const blockSupportsInteractivity = Object.is(
getBlockSupport( blockName, 'interactivity' ),
true
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can include as well non interactive blocks that supports client navigation (disabling force page reload). Those ones should have this block supports structure. You can check the paragraph block for example.

	"interactivity": {
			"clientNavigation": true
		}

const blockSupportsInteractivityClientNavigation =
getBlockSupport(
blockName,
'interactivity.clientNavigation'
);
const blockInteractivity =
blockSupportsInteractivity ||
blockSupportsInteractivityClientNavigation;
if ( ! blockInteractivity ) {
blocks.hasBlocksFromPlugins = true;
} else if ( blockName === 'core/post-content' ) {
blocks.hasPostContentBlock = true;
Expand Down