Skip to content

Commit

Permalink
Fix: Empty Classic Editor inside innerBlock fatal error (#17164)
Browse files Browse the repository at this point in the history
* Fix: Empty Classic Editor insider innerBlock fatal error

* Expand inline comment
  • Loading branch information
donmhico authored and mcsf committed Aug 26, 2019
1 parent 9b0cdf1 commit ef82afd
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/blocks/src/api/parser.js
Expand Up @@ -457,6 +457,12 @@ export function createBlockWithFallback( blockNode ) {
// Coerce inner blocks from parsed form to canonical form.
innerBlocks = innerBlocks.map( createBlockWithFallback );

// Remove `undefined` innerBlocks.
//
// This is a temporary fix to prevent unrecoverable TypeErrors when handling unexpectedly
// empty freeform block nodes. See https://github.com/WordPress/gutenberg/pull/17164.
innerBlocks = innerBlocks.filter( ( innerBlock ) => innerBlock );

const isFallbackBlock = (
name === freeformContentFallbackBlock ||
name === unregisteredFallbackBlock
Expand Down

0 comments on commit ef82afd

Please sign in to comment.