Skip to content

Commit

Permalink
Lodash: Remove _.pickBy() from latest posts block
Browse files Browse the repository at this point in the history
  • Loading branch information
tyxla committed Jan 9, 2023
1 parent f752350 commit 9c6e221
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/block-library/src/latest-posts/edit.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import { get, pickBy } from 'lodash';
import { get } from 'lodash';
import classnames from 'classnames';

/**
Expand Down Expand Up @@ -104,16 +104,15 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) {
categories && categories.length > 0
? categories.map( ( cat ) => cat.id )
: [];
const latestPostsQuery = pickBy(
{
const latestPostsQuery = Object.fromEntries(
Object.entries( {
categories: catIds,
author: selectedAuthor,
order,
orderby: orderBy,
per_page: postsToShow,
_embed: 'wp:featuredmedia',
},
( value ) => typeof value !== 'undefined'
} ).filter( ( [ , value ] ) => typeof value !== 'undefined' )
);

return {
Expand Down

0 comments on commit 9c6e221

Please sign in to comment.