The Block Registration RFC and the Gutenberg RFC process

While Slack is a critical tool for keeping in sync for project status and priorities, it has proven to be an ineffective platform to engage in detailed, long-lived discourse around complex engineering problems.

Inspired by other open source projects like React, Yarn, Rust… we started experimenting with a new RFC (Request For Comments) process in the Gutenberg repository in order to propose, discuss and adopt technical solutions for these big features or complex technical challenges.

The Block registration RFC

The first open RFC in the Gutenberg repository concerns the Block Registration API and intends to address the server-side awareness of blocks and simplify the block discovery for the block directory project.

The block registration API is the most important API in the block editor with a lot of technical challenges. Its implementation should fulfill a number of requirements:

  • A block type registration should be declarative and context-agnostic. Any runtime (PHP, JS, or other) should be able to interpret the basics of a block type (see “Block API” in the sections below) and should be able to fetch or retrieve the definitions of the context-specific implementation details. The following things should be made possible:
    • Fetching the available block types through REST APIs.
    • Fetching block objects from posts through REST APIs.
    • This API should be backward compatible with what we have at the moment.
    • It should be possible to statically analyze a block type in order to support advanced use-cases like the block discovery required by the Block Directory project.
  • It should not require a build tool compilation step (e.g. Babel, Webpack) to author code which would be referenced in a block type definition.
  • It should allow to dynamically load (“lazy-load”) block types, or parts of block type definitions. In practical terms, it means that the editor should be able to be loaded without enqueuing all the assets (scripts and styles) of all block types. What it needs is the basic metadata (title, description, category, icon, etc…) to start with. It should be fine to defer loading all other code (edit, save, transforms, and other JavaScript implementations) until it is explicitly used (inserted into the post content).

This RFC has already received a lot of feedback and technical explorations already started to clarify feasibility already started but I’d like to encourage everyone to chime-in and share thoughts.

What type of features/problems should be submitted as RFCs

All ideas/PRs/proposals require discussions before moving to implementation. When the proposed changes are small then a GitHub issue is fine but in addition to the block registration API, all the features and technical problems with impact across different areas of the code base, new patterns for extensibility APIs, technical problems that are hard to solve without making compromises are good candidates for RFCs.

Some examples for the Gutenberg project include:

  • The Block Registration API.
  • The Block Invalidation and Deprecation handling.
  • Block areas storage mechanism and widgets migration.
  • Block Bahaviour reuse (colors, alignments…).
  • Responsive Image Handling and Block Alignment awareness in nested contexts.
  • Editor Styles.

The RFC workflow

The flow to propose a new RFC is the following:

  • Create a RFC document for your proposal.
  • Submit a pull request to the Gutenberg repository (markdown file added to the `docs/rfc` folder).
  • Discuss and incorporate feedback into the PR
  • After discussions in the weekly meetings, RFCs may or may not be accepted.
  • If the RFC is accepted, the PR is merged.

Accepted RFCs means the proposed feature is approved for implementation. Once implemented, the RFC becomes the de-facto documentation for it.

What makes a good RFC document

A good RFC document can be broken into the following sections:

  • Description of the problems solved by the RFC
  • Current status and previous attempts
  • Solution Proposal
  • Unsolved Problems

Who can submit an RFC

Anyone can submit an RFC.

We’re looking forward to start receiving RFC proposals!

#core-editor, #gutenberg, #meta