Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Search: Remove unnecessary useEffect
  • Loading branch information
scruffian committed Jul 13, 2023
commit 47409a71072eca2b6bce48df121476e80b73851b
7 changes: 4 additions & 3 deletions packages/block-library/src/search/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,17 @@ export default function SearchEdit( {
);
const { __unstableMarkNextChangeAsNotPersistent } =
useDispatch( blockEditorStore );
useEffect( () => {
if ( ! insertedInNavigationBlock ) return;

if ( insertedInNavigationBlock ) {
// This side-effect should not create an undo level.
__unstableMarkNextChangeAsNotPersistent();
setAttributes( {
showLabel: false,
buttonUseIcon: true,
buttonPosition: 'button-inside',
} );
}, [ insertedInNavigationBlock ] );
}

const borderRadius = style?.border?.radius;
const borderProps = useBorderProps( attributes );

Expand Down