Skip to content

Commit

Permalink
Simplify insert declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
noisysocks committed Feb 1, 2018
1 parent e1a53ba commit 6d77903
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions editor/store/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -525,11 +525,9 @@ export function preferences( state = PREFERENCES_DEFAULTS, action ) {
switch ( action.type ) {
case 'INSERT_BLOCKS':
return action.blocks.reduce( ( prevState, block ) => {
let insert;
const insert = { name: block.name };
if ( isReusableBlock( block ) ) {
insert = { name: block.name, ref: block.attributes.ref };
} else {
insert = { name: block.name };
insert.ref = block.attributes.ref;
}

const isSameAsInsert = ( { name, ref } ) => name === insert.name && ref === insert.ref;
Expand Down

0 comments on commit 6d77903

Please sign in to comment.