Skip to content

Block directory doesn't work when blocks are hidden #38500

@ryelle

Description

@ryelle

Description

If you have any blocks hidden, the block directory won't load any external results. This is caused by the canInsertBlockType check, which checks against allowedBlockTypes. When there are hidden blocks, this list is set to the current registered blocks, minus those hidden blocks (source).

Since this is a safelist to match against, rather than a "disallowed" list, anything not on the list is blocked, and since it's created from locally registered blocks, nothing in the Block Directory is allowed.

Related to #33954

Step-by-step reproduction instructions

  1. Open an editor, go to Preferences > Blocks
  2. Uncheck some blocks
  3. Go back to the block inserter, try searching for a block in the directory — table, recipe, etc
  4. No results will load
  5. Unhide the blocks
  6. Try the search again, it should work

Screenshots, screen recording, code snippet

Screen.Recording.2022-02-03.at.12.49.18.PM.mov

Environment info

  • WP 6.0-alpha
  • Gutenberg trunk 7ab78a2
  • Theme: emptytheme
  • No other plugins

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Feature] Block APIAPI that allows to express the block paradigm.[Feature] Block DirectoryRelated to the Block Directory, a repository of block plugins[Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions