Skip to content

Commit

Permalink
Fix perf issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix authored and tellthemachines committed Jun 23, 2023
1 parent 9141d40 commit 3b89e82
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
11 changes: 9 additions & 2 deletions packages/block-editor/src/components/rich-text/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
* WordPress dependencies
*/
import { RawHTML } from '@wordpress/element';
import { children as childrenSource, getSaveElement } from '@wordpress/blocks';
import {
children as childrenSource,
getSaveElement,
__unstableGetBlockProps as getBlockProps,
} from '@wordpress/blocks';
import deprecated from '@wordpress/deprecated';

/**
Expand Down Expand Up @@ -72,7 +76,10 @@ function _getSaveElement( { name, attributes, innerBlocks } ) {
}

export function getRichTextValues( blocks = [] ) {
return findContent(
getBlockProps.skipFilters = true;
const values = findContent(
( Array.isArray( blocks ) ? blocks : [ blocks ] ).map( _getSaveElement )
);
getBlockProps.skipFilters = false;
return values;
}
14 changes: 8 additions & 6 deletions packages/blocks/src/api/serializer.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,14 @@ const innerBlocksPropsProvider = {};
*/
export function getBlockProps( props = {} ) {
const { blockType, attributes } = blockPropsProvider;
return applyFilters(
'blocks.getSaveContent.extraProps',
{ ...props },
blockType,
attributes
);
return getBlockProps.skipFilters
? props
: applyFilters(
'blocks.getSaveContent.extraProps',
{ ...props },
blockType,
attributes
);
}

/**
Expand Down

0 comments on commit 3b89e82

Please sign in to comment.