GithubHelp home page GithubHelp logo

Comments (4)

Mamaduka avatar Mamaduka commented on July 20, 2024 1

The BlockSwitcher checks the validity of blocks before rendering transformation options. It was introduced initially to solve a similar error - #28122.

I'm not against updating the getBlocksByClientId, but we should examine its usage in the code base in case any consumer relies on current behavior.

if ( ! _blocks.length || _blocks.some( ( block ) => ! block ) ) {
return { invalidBlocks: true };
}

from gutenberg.

t-hamano avatar t-hamano commented on July 20, 2024

Thanks for the report.

I also think that it should prevent the block editor from crashing, and that returning an array with null when the getBlocksByClientId parameter contains an invalid ID is not the expected behavior.

The getBlocksByClientId is expected to return an array of type WPBlock, but looking at the type below, null should not be allowed.

* @typedef WPBlock
*
* @property {string} name Block name
* @property {Object} attributes Block raw or comment attributes.
* @property {WPBlock[]} innerBlocks Inner Blocks.
* @property {string} originalContent Original content of the block before validation fixes.
* @property {boolean} isValid Whether the block is valid.
* @property {Object[]} validationIssues Validation issues.
* @property {WPRawBlock} [__unstableBlockSource] Un-processed original copy of block if created through parser.

from gutenberg.

artpi avatar artpi commented on July 20, 2024

For now I opened a PR with a spot remedy.

from gutenberg.

t-hamano avatar t-hamano commented on July 20, 2024

Fixed by #59410

from gutenberg.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.