Skip to content

Commit

Permalink
Lodash: Refactor away from _.omitBy() (#45010)
Browse files Browse the repository at this point in the history
  • Loading branch information
tyxla authored Oct 17, 2022
1 parent 946bfcd commit 79ec7cf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ module.exports = {
'negate',
'noop',
'nth',
'omitBy',
'once',
'overEvery',
'partial',
Expand Down
14 changes: 7 additions & 7 deletions packages/block-editor/src/store/reducer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import { reduce, omit, mapValues, isEqual, isEmpty, omitBy } from 'lodash';
import { reduce, omit, mapValues, isEqual, isEmpty } from 'lodash';

/**
* WordPress dependencies
Expand Down Expand Up @@ -417,15 +417,15 @@ const withBlockTree =
break;
}
case 'SAVE_REUSABLE_BLOCK_SUCCESS': {
const updatedBlockUids = Object.keys(
omitBy( newState.attributes, ( attributes, clientId ) => {
const updatedBlockUids = Object.entries( newState.attributes )
.filter( ( [ clientId, attributes ] ) => {
return (
newState.byClientId[ clientId ].name !==
'core/block' ||
attributes.ref !== action.updatedId
newState.byClientId[ clientId ].name ===
'core/block' &&
attributes.ref === action.updatedId
);
} )
);
.map( ( [ clientId ] ) => clientId );

newState.tree = updateParentInnerBlocksInTree(
newState,
Expand Down

0 comments on commit 79ec7cf

Please sign in to comment.