Skip to content

Commit

Permalink
Fix the block name via metadata when Seach is instant.
Browse files Browse the repository at this point in the history
  • Loading branch information
michalczaplinski committed Nov 25, 2024
1 parent b21b2d7 commit 0894c32
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/block-library/src/search/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,12 @@ export default function SearchEdit( {

useEffect( () => {
if ( isEnhancedPagination ) {
// Add the name to the metadata
setAttributes( { metadata: { name: 'Instant Search' } } );
} else {
setAttributes( { metadata: { name: label } } );
// Remove the name from the metadata
const { name, ...metadata } = attributes.metadata || {};
setAttributes( { metadata } );
}
}, [ isEnhancedPagination, setAttributes, label ] );

Expand Down

0 comments on commit 0894c32

Please sign in to comment.