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

Block Hooks: Set ignoredHookedBlocks metada attr upon insertion #58553

Merged
merged 24 commits into from
Feb 8, 2024
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
Revert change to block-hooks.js
  • Loading branch information
ockham committed Feb 8, 2024
commit c687f8a35f37de58c815806f45bfb34cd21278a6
16 changes: 12 additions & 4 deletions packages/block-editor/src/hooks/block-hooks.js
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { Fragment } from '@wordpress/element';
import { Fragment, useMemo } from '@wordpress/element';
import {
__experimentalHStack as HStack,
PanelBody,
@@ -20,9 +20,17 @@ import { store as blockEditorStore } from '../store';
const EMPTY_OBJECT = {};

function BlockHooksControlPure( { name, clientId } ) {
const hookedBlocksForCurrentBlock = useSelect(
( select ) => select( blocksStore ).getHookedBlockNames( name ),
[ name ]
const blockTypes = useSelect(
( select ) => select( blocksStore ).getBlockTypes(),
[]
);

const hookedBlocksForCurrentBlock = useMemo(
() =>
blockTypes?.filter(
( { blockHooks } ) => blockHooks && name in blockHooks
),
[ blockTypes, name ]
);

const { blockIndex, rootClientId, innerBlocksLength } = useSelect(