Skip to content

Commit

Permalink
Latest Posts: Declare 'hasPosts' before 'inspectorControls' (#32160)
Browse files Browse the repository at this point in the history
* Fixes "Uncaught ReferenceError."
* Simplifies 'hasPosts' check.
  • Loading branch information
Mamaduka authored and youknowriad committed May 31, 2021
1 parent 506470f commit 8dc059f
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 8dc059f

Please sign in to comment.