Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command Palette Error because of block transform in 6.4 RC 2 #55668

Closed
bfintal opened this issue Oct 27, 2023 · 2 comments · Fixed by #55676
Closed

Command Palette Error because of block transform in 6.4 RC 2 #55668

bfintal opened this issue Oct 27, 2023 · 2 comments · Fixed by #55676
Assignees
Labels
[Package] Block editor /packages/block-editor [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@bfintal
Copy link
Contributor

bfintal commented Oct 27, 2023

Description

If you have a block that has a transform from core/paragraph (it's not specific to only this block, happens also in core/heading), then you try using the command palette, it will cause the whole editor to crash.

Here's the error:

Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Step-by-step reproduction instructions

Using WP 6.4 RC2:

  1. Edit a page
  2. Enter this dummy block in the editor using the browser console:
wp.blocks.registerBlockType( 'example/text', {
	title: 'text',
	edit: () => wp.element.createElement( 'div', { children: 'hello' } ),
	save: () => null,
    transforms: {
        from: [
            {
                type: 'block',
                isMultiBlock: true,
                blocks: [ 'core/paragraph' ],
                transform: () => {},
            },
        ],
    },
} )

The important thing with this block is that it has a transform from a core/paragraph.

  1. Add a paragraph block in the page
  2. Select the paragraph block
  3. Bring up the command palette (cmd/ctrl + K, you may have to press escape since this can also bring up the link popup in the text)
  4. Type anything, it will produce the error.

Screenshots, screen recording, code snippet

image

Here's a screen recording without the error. In this video, it's just a new page, added a paragraph block and used the command palette:

Screen.Recording.2023-10-28.at.1.10.16.AM.mov

Here's a screen recording with the error. In this video, I continued from the previous video, registering the block with the transform, then used the command palette and getting the error:

Screen.Recording.2023-10-28.at.1.10.40.AM.mov

Environment info

  • WordPress 6.4 RC2

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

@t-hamano
Copy link
Contributor

Thanks for the report.

I was able to reproduce this issue as well, so I submitted #55676 to fix it.

@bfintal
Copy link
Contributor Author

bfintal commented Oct 28, 2023

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Block editor /packages/block-editor [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants