Skip to content

Commit

Permalink
Merge pull request #3247 from WordPress/update/perf-block-selection
Browse files Browse the repository at this point in the history
Performance: Memoize by specific block selection state keys
  • Loading branch information
aduth authored Oct 31, 2017
2 parents 77b146d + 7c4c2ca commit 9b148e1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions editor/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,11 @@ export const getMultiSelectedBlockUids = createSelector(

return blockOrder.slice( startIndex, endIndex + 1 );
},
( state ) => [ state.editor.blockOrder, state.blockSelection ],
( state ) => [
state.editor.blockOrder,
state.blockSelection.start,
state.blockSelection.end,
],
);

/**
Expand All @@ -604,7 +608,8 @@ export const getMultiSelectedBlocks = createSelector(
( state ) => getMultiSelectedBlockUids( state ).map( ( uid ) => getBlock( state, uid ) ),
( state ) => [
state.editor.blockOrder,
state.blockSelection,
state.blockSelection.start,
state.blockSelection.end,
state.editor.blocksByUid,
state.editor.edits.meta,
state.currentPost.meta,
Expand Down

0 comments on commit 9b148e1

Please sign in to comment.