Skip to content

Commit

Permalink
Latest Posts: Declare 'hasPosts' before 'inspectorControls'
Browse files Browse the repository at this point in the history
* Fixes "Uncaught ReferenceError."
* Simplifies 'hasPosts' check.
  • Loading branch information
Mamaduka committed May 25, 2021
1 parent a35eb40 commit b395e53
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/block-library/src/latest-posts/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) {
};
}, [] );

const hasPosts = !! latestPosts?.length;
const inspectorControls = (
<InspectorControls>
<PanelBody title={ __( 'Post content settings' ) }>
Expand Down Expand Up @@ -412,7 +413,6 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) {
} ),
} );

const hasPosts = Array.isArray( latestPosts ) && latestPosts.length;
if ( ! hasPosts ) {
return (
<div { ...blockProps }>
Expand Down

0 comments on commit b395e53

Please sign in to comment.