Skip to content

Commit

Permalink
update getBlocksByUID
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Feb 23, 2018
1 parent 80b1a2a commit 968580d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function BlockDuplicateButton( { blocks, onDuplicate, onClick = noop, isL

export default compose(
withSelect( ( select, { uids, rootUID } ) => ( {
blocks: select( 'core/editor' ).getBlocksByUid( uids ),
blocks: select( 'core/editor' ).getBlocksByUID( uids ),
index: select( 'core/editor' ).getBlockIndex( last( uids ), rootUID ),
} ) ),
withDispatch( ( dispatch, { blocks, index, rootUID } ) => ( {
Expand Down
5 changes: 4 additions & 1 deletion editor/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -439,12 +439,15 @@ export const getBlocks = createSelector(
]
);

export const getBlocksByUid = createSelector(
export const getBlocksByUID = createSelector(
( state, uids ) => {
return map( uids, ( uid ) => getBlock( state, uid ) );
},
( state ) => [
state.editor.present.blocksByUid,
state.editor.present.blockOrder,
state.editor.present.edits.meta,
state.currentPost.meta,
state.editor.present.blocksByUid,
]
);
Expand Down

0 comments on commit 968580d

Please sign in to comment.