From 602c44f638beb060da2a9ac76b33c1f19f119286 Mon Sep 17 00:00:00 2001 From: Dennis Snell Date: Mon, 21 Feb 2022 21:20:45 -0700 Subject: [PATCH] Fix test case given an invalid block without a source. Potentially this is a conflict with #38794 and once `isValidBlockContent` is gone we might be able to remove this change. --- packages/block-editor/src/components/block-list/block.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/block-editor/src/components/block-list/block.js b/packages/block-editor/src/components/block-list/block.js index e2e18b820b3e3d..037aebe18aecef 100644 --- a/packages/block-editor/src/components/block-list/block.js +++ b/packages/block-editor/src/components/block-list/block.js @@ -15,6 +15,7 @@ import { } from '@wordpress/element'; import { getBlockType, + getSaveContent, isUnmodifiedDefaultBlock, serializeRawBlock, } from '@wordpress/blocks'; @@ -156,7 +157,9 @@ function BlockListBlock( { let block; if ( ! isValid ) { - const saveContent = serializeRawBlock( source ); + const saveContent = source + ? serializeRawBlock( source ) + : getSaveContent( blockType, attributes ); block = (