Skip to content

Commit

Permalink
add comment for auto-creation in placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
Addison-Stavlo committed Oct 20, 2020
1 parent 15354fc commit 07fce86
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,17 @@ export default function TemplatePartPlaceholder( {
} );
}, [ setAttributes ] );

// If there are inner blocks already present, this is a convert to template part flow.
// Therefore immediately create the template part with the given inner blocks.
useEffect( () => {
if ( innerBlocks.length ) {
onCreate();
}
}, [] );

if ( innerBlocks.length ) {
return <Spinner />;
}

return (
<Placeholder
icon={ blockDefault }
Expand Down

0 comments on commit 07fce86

Please sign in to comment.