Skip to content

Commit

Permalink
Add spinner when loading in Query (#31095)
Browse files Browse the repository at this point in the history
  • Loading branch information
ntsekouras authored Apr 23, 2021
1 parent 4e52072 commit 3011744
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/block-library/src/query-loop/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
__experimentalUseInnerBlocksProps as useInnerBlocksProps,
store as blockEditorStore,
} from '@wordpress/block-editor';
import { Spinner } from '@wordpress/components';
import { store as coreStore } from '@wordpress/core-data';

const TEMPLATE = [
Expand Down Expand Up @@ -127,7 +128,11 @@ export default function QueryLoopEdit( {
const innerBlocksProps = useInnerBlocksProps( {}, { template: TEMPLATE } );

if ( ! posts ) {
return <p { ...blockProps }>{ __( 'Loading…' ) }</p>;
return (
<p { ...blockProps }>
<Spinner />
</p>
);
}

if ( ! posts.length ) {
Expand Down

0 comments on commit 3011744

Please sign in to comment.