Skip to content

Commit

Permalink
Address remounting concern
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed Jan 19, 2024
1 parent 0273411 commit b20a114
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions packages/edit-site/src/hooks/template-part-edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,14 @@ export const withEditBlockControls = createHigherOrderComponent(
const { attributes, name } = props;
const isDisplayed = name === 'core/template-part' && attributes.slug;

if ( ! isDisplayed ) {
return <BlockEdit { ...props } />;
}

return (
<>
<BlockEdit { ...props } />
<BlockControls group="other">
<EditTemplatePartMenuItem attributes={ attributes } />
</BlockControls>
<BlockEdit key="edit" { ...props } />
{ isDisplayed && (
<BlockControls group="other">
<EditTemplatePartMenuItem attributes={ attributes } />
</BlockControls>
) }
</>
);
},
Expand Down

0 comments on commit b20a114

Please sign in to comment.