Skip to content

Commit

Permalink
Update packages/block-library/src/pattern/edit.js
Browse files Browse the repository at this point in the history
Co-authored-by: Miguel Fonseca <[email protected]>
  • Loading branch information
jffng and mcsf committed Oct 7, 2021
1 parent e3bc3a4 commit 7ec0995
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/block-library/src/pattern/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ const PatternEdit = ( { attributes, clientId, isSelected } ) => {
// This replaces the Pattern block wrapper with the content of the pattern.
// This change won't be saved unless further changes are made to the InnerBlocks.
useEffect( () => {
if ( selectedPattern?.blocks ) {
if ( hasSelection && selectedPattern?.blocks ) {
__unstableMarkNextChangeAsNotPersistent();
replaceBlocks( clientId, selectedPattern.blocks );
}
}, [ hasSelection ] );
}, [ hasSelection, selectedPattern?.blocks ] );

// Run this effect when the component loads.
// This adds the Pattern block template as InnerBlocks.
Expand Down

0 comments on commit 7ec0995

Please sign in to comment.