Skip to content

Commit

Permalink
Use two conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamaduka committed Feb 24, 2023
1 parent 6ec2619 commit bb2a37c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/block-library/src/template-part/edit/import-controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,16 @@ export function TemplatePartImportControls( { area, setAttributes } ) {
];
}, [ sidebars ] );

// Render an empty node while data is loading or when there is nothing to import;
// to avoid SlotFill re-positioning issue. See: https://github.com/WordPress/gutenberg/issues/15641.
if ( ! hasResolved || ( hasResolved && ! options.length ) ) {
// Render an empty node while data is loading to avoid SlotFill re-positioning bug.
// See: https://github.com/WordPress/gutenberg/issues/15641.
if ( ! hasResolved ) {
return <Spacer marginBottom="0" />;
}

if ( hasResolved && ! options.length ) {
return null;
}

async function createFromWidgets( event ) {
event.preventDefault();

Expand Down

0 comments on commit bb2a37c

Please sign in to comment.