Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the query block to permit non-core interactive blocks #60006

Merged
Show file tree
Hide file tree
Changes from 1 commit
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 blocks from plugins are present inside the Query block.'
cbravobernal marked this conversation as resolved.
Show resolved Hide resolved
) +
' ' +
notice;
Expand Down
15 changes: 13 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,14 @@ export const useUnsupportedBlocks = ( clientId ) => {
getClientIdsOfDescendants( clientId ).forEach(
( descendantClientId ) => {
const blockName = getBlockName( descendantClientId );
if ( ! blockName.startsWith( 'core/' ) ) {
const blockInteractivity = getBlockSupport(
blockName,
'interactivity'
);
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
		}

if (
! blockName.startsWith( 'core/' ) &&
gziolo marked this conversation as resolved.
Show resolved Hide resolved
! blockInteractivity
colinduwe marked this conversation as resolved.
Show resolved Hide resolved
) {
blocks.hasBlocksFromPlugins = true;
} else if ( blockName === 'core/post-content' ) {
blocks.hasPostContentBlock = true;
Expand Down
Loading