combine conditions for early return

This commit is contained in:
Bart Kalisz 2024-09-06 13:35:44 +02:00 committed by Christopher Allford
parent ac60428bc9
commit 50bec181e1
No known key found for this signature in database
GPG Key ID: 80E44C778F08A88E
1 changed files with 2 additions and 4 deletions

View File

@ -300,15 +300,13 @@ const CollectionSpecificControls = (
const withCollectionSpecificControls =
< T extends EditorBlock< T > >( BlockEdit: ElementType ) =>
( props: ProductCollectionEditComponentProps ) => {
if ( ! isProductCollection( props.name ) ) {
if ( ! isProductCollection( props.name ) || ! props.isSelected ) {
return <BlockEdit { ...props } />;
}
return (
<>
{ props.isSelected && (
<CollectionSpecificControls { ...props } />
) }
<CollectionSpecificControls { ...props } />
<BlockEdit { ...props } />
</>
);