WordPress/gutenberg

Registration: Server registration is not validated on client

開放

#6,702 建立於 2018年5月11日

 (1 則留言) (2 個反應) (0 位負責人)JavaScript (3,893 個分叉)batch import
Good First IssueNeeds Dev[Feature] Block API[Status] In Progress[Type] Enhancement

倉庫指標

星標
 (9,607 顆星)
PR 合併指標
 (平均合併 12天 18小時) (30 天內合併 509 個 PR)

描述

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.

貢獻者指南