From 77fec369889d5a1bf81d42fb5da52fcaae038358 Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Thu, 8 Feb 2024 16:36:46 +0400 Subject: [PATCH] Block Bindings: Remove unneeded 'setAttributes' override (#58806) Co-authored-by: Mamaduka Co-authored-by: ellatrix Co-authored-by: SantosGuillamot --- .../src/hooks/use-bindings-attributes.js | 24 ++++++------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/packages/block-editor/src/hooks/use-bindings-attributes.js b/packages/block-editor/src/hooks/use-bindings-attributes.js index c6c847cbddcd1c..680e331d1da5a5 100644 --- a/packages/block-editor/src/hooks/use-bindings-attributes.js +++ b/packages/block-editor/src/hooks/use-bindings-attributes.js @@ -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 @@ -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 ) { @@ -80,21 +79,12 @@ const createEditFunctionWithBindingsAttribute = () => ); } - const registry = useRegistry(); - return ( - <> - - registry.batch( () => - updateBlockAttributes( blockId, newAttributes ) - ) - } - { ...props } - /> - + ); }, 'useBoundAttributes'