Skip to content

Commit

Permalink
Lodash: Refactor away from _.set() in getNodesWithSettings() (#52278)
Browse files Browse the repository at this point in the history
  • Loading branch information
tyxla authored Jul 10, 2023
1 parent ee7b90d commit 42d5624
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

1 comment on commit 42d5624

@github-actions
Copy link

@github-actions github-actions bot commented on 42d5624 Jul 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 42d5624.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5505341924
📝 Reported issues:

Please sign in to comment.