Skip to content

Commit

Permalink
Avoid iterating through reusable blocks twice
Browse files Browse the repository at this point in the history
Use _.map to avoid iterating through the reusable blocks twice in
`getReusableBlocks`.
  • Loading branch information
noisysocks committed Mar 14, 2018
1 parent 1b3f1ba commit 4025b7a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion editor/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -1332,7 +1332,7 @@ export function isFetchingReusableBlock( state, ref ) {
* @return {Array} An array of all reusable blocks.
*/
export function getReusableBlocks( state ) {
return Object.keys( state.reusableBlocks.data ).map( ( ref ) => getReusableBlock( state, ref ) );
return map( state.reusableBlocks.data, ( value, ref ) => getReusableBlock( state, ref ) );
}

/**
Expand Down

0 comments on commit 4025b7a

Please sign in to comment.