WordPress/gutenberg

Registration: Server registration is not validated on client

Open

#6702 opened on May 11, 2018

View on GitHub
 (1 comment) (2 reactions) (0 assignees)JavaScript (9,607 stars) (3,893 forks)batch import
Good First IssueNeeds Dev[Feature] Block API[Status] In Progress[Type] Enhancement

Description

While experimenting with the server-side registry of custom blocks, I ran into a problem where my block was supposedly being registered correctly on the server-side, but it did not appear in the block picker in the client-side.

In the end, I figured out that I had used the properties to enqueue scripts/styles through the server registration in the wrong way: I had used a dash instead of an underscore in the properties, i.e. 'editor-script' instead of 'editor_script'.

However, I would have expected Gutenberg to show some kind of warning (at least in the console) when I register something on the server-side and it ends up not creating anything on the client-side. I cannot think of a use case where you would want to register something on the server only to not have it exist on the client.

This is why I'd like to suggest adding a check in JS-land that gives some kind of feedback to developers when server-registered blocks are missing on the client.

Contributor guide