Skip to content

Commit

Permalink
Remove the HOC for Block Bindings to verify performance implications
Browse files Browse the repository at this point in the history
  • Loading branch information
gziolo committed Dec 3, 2024
1 parent 5365702 commit ba9c483
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions packages/block-editor/src/components/block-edit/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ import { useContext, useMemo } from '@wordpress/element';
* Internal dependencies
*/
import BlockContext from '../block-context';
import { withBlockBindingsSupport } from './with-block-bindings-support';
import { canBindBlock } from '../../utils/block-bindings';

/**
* Default value used for blocks which do not define their own context needs,
Expand Down Expand Up @@ -49,7 +47,7 @@ const Edit = ( props ) => {

const EditWithFilters = withFilters( 'editor.BlockEdit' )( Edit );

const EditWithFiltersAndBindings = withBlockBindingsSupport( EditWithFilters );
// const EditWithFiltersAndBindings = withBlockBindingsSupport( EditWithFilters );

const EditWithGeneratedProps = ( props ) => {
const { attributes = {}, name } = props;
Expand All @@ -71,12 +69,8 @@ const EditWithGeneratedProps = ( props ) => {
return null;
}

const EditComponent = canBindBlock( name )
? EditWithFiltersAndBindings
: EditWithFilters;

if ( blockType.apiVersion > 1 ) {
return <EditComponent { ...props } context={ context } />;
return <EditWithFilters { ...props } context={ context } />;
}

// Generate a class name for the block's editable form.
Expand All @@ -90,7 +84,7 @@ const EditWithGeneratedProps = ( props ) => {
);

return (
<EditComponent
<EditWithFilters
{ ...props }
context={ context }
className={ className }
Expand Down

0 comments on commit ba9c483

Please sign in to comment.