Skip to content

Commit

Permalink
Block Bindings: Remove unneeded 'setAttributes' override (#58806)
Browse files Browse the repository at this point in the history
Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: ellatrix <[email protected]>
Co-authored-by: SantosGuillamot <[email protected]>
  • Loading branch information
4 people authored Feb 8, 2024
1 parent 11fe025 commit 77fec36
Showing 1 changed file with 7 additions and 17 deletions.
24 changes: 7 additions & 17 deletions packages/block-editor/src/hooks/use-bindings-attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
import { getBlockType } from '@wordpress/blocks';
import { createHigherOrderComponent } from '@wordpress/compose';
import { useRegistry, useSelect } from '@wordpress/data';
import { useSelect } from '@wordpress/data';
import { addFilter } from '@wordpress/hooks';
/**
* Internal dependencies
Expand Down Expand Up @@ -36,8 +36,7 @@ const createEditFunctionWithBindingsAttribute = () =>
const { getBlockBindingsSource } = unlock(
useSelect( blockEditorStore )
);
const { getBlockAttributes, updateBlockAttributes } =
useSelect( blockEditorStore );
const { getBlockAttributes } = useSelect( blockEditorStore );

const updatedAttributes = getBlockAttributes( clientId );
if ( updatedAttributes?.metadata?.bindings ) {
Expand Down Expand Up @@ -80,21 +79,12 @@ const createEditFunctionWithBindingsAttribute = () =>
);
}

const registry = useRegistry();

return (
<>
<BlockEdit
key="edit"
attributes={ updatedAttributes }
setAttributes={ ( newAttributes, blockId ) =>
registry.batch( () =>
updateBlockAttributes( blockId, newAttributes )
)
}
{ ...props }
/>
</>
<BlockEdit
key="edit"
attributes={ updatedAttributes }
{ ...props }
/>
);
},
'useBoundAttributes'
Expand Down

0 comments on commit 77fec36

Please sign in to comment.