Skip to content

Commit

Permalink
Performance: Memoize by specific block selection state keys
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth committed Oct 30, 2017
1 parent 8029705 commit 7c4c2ca
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 @@ -569,7 +569,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 @@ -583,7 +587,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 7c4c2ca

Please sign in to comment.