WordPress/gutenberg

Registration: Server registration is not validated on client

Open

#6702 aperta il 11 mag 2018

Vedi su GitHub
 (1 commento) (2 reazioni) (0 assegnatari)JavaScript (3893 fork)batch import
Good First IssueNeeds Dev[Feature] Block API[Status] In Progress[Type] Enhancement

Metriche repository

Star
 (9607 star)
Metriche merge PR
 (Merge medio 12g 18h) (509 PR mergiate in 30 g)

Descrizione

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.

Guida contributor