Skip to content

Commit

Permalink
Remove extra filtering of block bindings empty sources (WordPress#65447)
Browse files Browse the repository at this point in the history
Co-authored-by: SantosGuillamot <santosguillamot@git.wordpress.org>
Co-authored-by: gziolo <gziolo@git.wordpress.org>
  • Loading branch information
3 people committed Sep 18, 2024
1 parent 6a6b3a3 commit 54da44d
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions packages/block-editor/src/hooks/block-bindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
}
}
Expand All @@ -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 };
Expand Down

0 comments on commit 54da44d

Please sign in to comment.