Skip to content

Let the framework register the blocks - #1

Merged
ogorzalka merged 2 commits into
mainfrom
fix/blocks-without-provider
Sep 24, 2026
Merged

ogorzalka merged 2 commits into
mainfrom
fix/blocks-without-provider

Conversation

@ogorzalka

Copy link
Copy Markdown
Member

Why

  • BlocksServiceProvider only ever registered the blocks under WP-CLI: in a web request, init has already run when a theme's providers boot. Since framework v13.32.0-beta.7 the framework registers resources/views/blocks itself.
  • hero/edit.jsx showed the placeholder "Hero – Block Editor" while save.jsx stores "Hero".

Changes

  • Provider removed, along with the contract test that required it.
  • Install check: the block registry is asked of the REST API over HTTP (temporary admin, cookie + nonce) instead of wp eval.
    • v13.4.0 leg: --expect-blocks=no. That version never registered blocks in a web request, so the check asserts their absence.
    • dev-main leg: every block must be present.
  • Overlay: a file the commit under test deletes is removed from the generated theme (under app/, config/, resources/). Without that, CI would have measured the theme with the provider still there, from tag v1.4.4.
  • hero/edit.jsx mirrors save.jsx.

After the tag: remove previewGap for default/hero in the framework's tests/e2e/specs/blocks.spec.ts.

edit.jsx rendered the scaffold placeholder "Hero – Block Editor" while
save.jsx stores "Hero": the editor did not show what the page would
hold. It now mirrors save.jsx, as make:block's static stub does.
Framework v13.32.0-beta.7 registers every theme's resources/views/blocks
itself. BlocksServiceProvider deferred its own registration to `init`,
which has already run when a theme's providers boot in a web request: it
only ever registered the blocks under WP-CLI. It goes, with the contract
test that required it.

The install check asked WP-CLI for the registry, the context that hid
this. It now asks the REST API, logged in, over HTTP. v13.4.0 registers
no block in a web request and is tagged, so its leg passes
--expect-blocks=no and the check asserts that absence.

The overlay only added and overwrote files, so a file deleted by the
commit under test survived from the tag and CI measured a theme that
still had it. It now removes, under app/, config/ and resources/, what
the commit no longer has.
@ogorzalka
ogorzalka merged commit b05b0c2 into main Sep 24, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant