From 54da44d444b7dbc031171aa8a461f34b5d115065 Mon Sep 17 00:00:00 2001 From: Mario Santos <34552881+SantosGuillamot@users.noreply.github.com> Date: Wed, 18 Sep 2024 17:14:21 +0200 Subject: [PATCH] Remove extra filtering of block bindings empty sources (#65447) Co-authored-by: SantosGuillamot Co-authored-by: gziolo --- packages/block-editor/src/hooks/block-bindings.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/packages/block-editor/src/hooks/block-bindings.js b/packages/block-editor/src/hooks/block-bindings.js index 33284b4cd27fd5..ea0d4cbb7fb5bf 100644 --- a/packages/block-editor/src/hooks/block-bindings.js +++ b/packages/block-editor/src/hooks/block-bindings.js @@ -218,7 +218,7 @@ export const BlockBindingsPanel = ( { name: blockName, metadata } ) => { context, } ); // Only add source if the list is not empty. - if ( sourceList ) { + if ( Object.keys( sourceList || {} ).length ) { _fieldsList[ sourceName ] = { ...sourceList }; } } @@ -240,12 +240,6 @@ export const BlockBindingsPanel = ( { name: blockName, metadata } ) => { if ( ! bindableAttributes || bindableAttributes.length === 0 ) { return null; } - // Remove empty sources from the list of fields. - Object.entries( fieldsList ).forEach( ( [ key, value ] ) => { - if ( ! Object.keys( value ).length ) { - delete fieldsList[ key ]; - } - } ); // Filter bindings to only show bindable attributes and remove pattern overrides. const { bindings } = metadata || {}; const filteredBindings = { ...bindings };