Skip to content

Commit

Permalink
Lodash: Refactor away from _.set() in getNodesWithSettings()
Browse files Browse the repository at this point in the history
  • Loading branch information
tyxla committed Jul 7, 2023
1 parent 4e9b121 commit 0e44ec1
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
import { get, set } from 'lodash';
import { get } from 'lodash';

/**
* WordPress dependencies
Expand Down Expand Up @@ -32,7 +32,7 @@ import { PresetDuotoneFilter } from '../duotone/components';
import { getGapCSSValue } from '../../hooks/gap';
import { store as blockEditorStore } from '../../store';
import { LAYOUT_DEFINITIONS } from '../../layouts/definitions';
import { kebabCase } from '../../utils/object';
import { kebabCase, setImmutably } from '../../utils/object';

// List of block support features that can have their related styles
// generated under their own feature level selector rather than the block's.
Expand Down Expand Up @@ -678,11 +678,11 @@ export const getNodesWithSettings = ( tree, blockSelectors ) => {
}

const pickPresets = ( treeToPickFrom ) => {
const presets = {};
let presets = {};
PRESET_METADATA.forEach( ( { path } ) => {
const value = get( treeToPickFrom, path, false );
if ( value !== false ) {
set( presets, path, value );
presets = setImmutably( presets, path, value );
}
} );
return presets;
Expand Down

0 comments on commit 0e44ec1

Please sign in to comment.