Skip to content

Commit

Permalink
Replace remaining custom deep cloning with 'structuredClone'
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamaduka committed Dec 7, 2024
1 parent 72417c3 commit 4fec584
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ function pickStyleKeys( treeToPickFrom ) {
// clone the style objects so that `getFeatureDeclarations` can remove consumed keys from it
const clonedEntries = pickedEntries.map( ( [ key, style ] ) => [
key,
JSON.parse( JSON.stringify( style ) ),
structuredClone( style ),
] );
return Object.fromEntries( clonedEntries );
}
Expand Down
2 changes: 1 addition & 1 deletion packages/block-editor/src/hooks/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ export function omitStyle( style, paths, preserveReference = false ) {

let newStyle = style;
if ( ! preserveReference ) {
newStyle = JSON.parse( JSON.stringify( style ) );
newStyle = structuredClone( style );
}

if ( ! Array.isArray( paths ) ) {
Expand Down

0 comments on commit 4fec584

Please sign in to comment.