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

Custom block broken since 8.4.0 #23627

Closed
ghost opened this issue Jul 1, 2020 · 4 comments
Closed

Custom block broken since 8.4.0 #23627

ghost opened this issue Jul 1, 2020 · 4 comments
Labels
[Type] Help Request Help with setup, implementation, or "How do I?" questions.

Comments

@ghost
Copy link

ghost commented Jul 1, 2020

Since updating to Gutenberg 8.4.0, my custom block doesn't work anymore when the Gutenberg plugin is active but still works in the builtin WordPress block editor.

Everything works fine in Gutenberg 8.3.0.
As soon as I update to version 8.4.0, the block doesn't show up anymore in the list of the available blocks when I try to add a new one and all the blocks already on the page fail to load with the following error:

Your site doesn’t include support for the "waveplayer/block" block. You can leave this block intact or remove it entirely.

No errors are triggered in the PHP debug log or the Javascript browser console.
Any help troubleshooting this issue is greatly appreciated. Honestly, I wouldn't know where to start.
I have already checked the changelog and haven't found any info about a possible break of blocks perfectly working in the previous version.

Please advise.

@oxyc
Copy link
Member

oxyc commented Jul 1, 2020

If you can join WordPress slack, send me a message and maybe I can help debug it. My username is oxy.

@oxyc oxyc added the [Type] Help Request Help with setup, implementation, or "How do I?" questions. label Jul 1, 2020
@ghost
Copy link
Author

ghost commented Jul 1, 2020

Thanks @oxyc, I believe I found the issue.
Apparently, until version 8.3.0 (and in WordPress without Gutenberg installed), REGISTERING the block editor assets is enough to activate the block in the callback function hooked to the enqueue_block_editor_assets action.

Starting from version 8.4.0, for some reason that I have not been able to track down yet, simply registering the script is not enough anymore and ENQUEUING the block editor assets becomes necessary.

I am not sure why until version 8.3.0 and in WordPress without the Gutenberg plugin installed the mere registration of the assets is enough to activate the block, while in the latest version 8.4.0 this doesn't work anymore. Unless I missed something, this change has not been documented anywhere.

@oxyc
Copy link
Member

oxyc commented Jul 2, 2020

Ah, it might have to do with #22754

@ghost
Copy link
Author

ghost commented Jul 2, 2020

Thanks for pointing that out.

The problem was certainly connected to the PR you mentioned and caused by the actions I used to register the block assets.
I used to register the assets using the enqueue_block_assets and the enqueue_block_editor_assets action hooks.
This was working as expected until Gutenberg 8.3.0 and with the current version of WordPress.

With this new approach, though, apparently those actions are too late to register the assets. So, moving the registration of the assets to the init action hook solves the issue.

Thanks for your help!

@ghost ghost closed this as completed Jul 2, 2020
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Help Request Help with setup, implementation, or "How do I?" questions.
Projects
None yet
Development

No branches or pull requests

1 participant