📚 docs(blocks): document that removing a block breaks published content - #143
Open
kuuak wants to merge 1 commit into
Open
📚 docs(blocks): document that removing a block breaks published content#143kuuak wants to merge 1 commit into
kuuak wants to merge 1 commit into
Conversation
`create-block.md` explains every step needed to register a block, but never says that registration is what keeps *already-published* content renderable. That makes a registration look like scaffolding for new content — something safe to tidy away during an unrelated refactor. It isn't. Dropping a slug from `blocksList` makes the frontend render nothing and log "The following block does not exist: <slug>", and dropping the WordPress-side registration makes Gutenberg treat the saved markup as invalid content. Because the slug is the link between saved content and code, a rename is a removal plus an addition. - Add a "Removing or renaming a block" section to the guide. - Add a matching rule to the wordpress-block-change skill, next to the existing "no duplicate registrations" rule, so coding agents get the same constraint. No behaviour change — documentation only.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
docs/blocks/create-block.mdexplains every step needed to register a block, but never says what registration is for once the block exists. Read as-is, a registration entry looks like scaffolding for new content — something safe to tidy away during an unrelated refactor.It isn't. Registration is the link between already-published content and code:
blocksListinnext/src/components/global/Blocks.tsx→ the frontend renders nothing and logsThe following block does not exist: <slug>(seeBlocks.tsx:113).Because the slug is that link, a rename is a removal plus an addition — existing content still points at the old slug.
Now that registration is split across WordPress and Next, there are two independent ways to break live pages, and the guide flagged neither.
What changed
Documentation only — no behaviour change.
docs/blocks/create-block.md— new "Removing or renaming a block" section, placed before the checklist..claude/skills/wordpress-block-change/SKILL.md— a matching change rule, next to the existing "Do not introduce duplicate block registrations" rule. That rule covers adding duplicates but says nothing about removal, so coding agents using the skill had no reason not to drop one.The quoted warning string is verbatim from
Blocks.tsx; both relative links and the heading anchor were checked.Context
This came out of a headless-WP project built on an older Superstack generation, where the equivalent rule lived in an ad-hoc
.cursor/rulesfile as "NEVER delete wordpress blocks from the edit file". The constraint is a property of the stack rather than of any one project, so it belongs here.Unrelated observation — stale paths in
create-block.mdNot addressed in this PR (I'd be guessing at the intended structure), but noticed while adapting the doc. Checked against
future@ 4a3943a:wordpress/theme/src/blocks/wordpress/theme/src/blocks/index.tswordpress/theme/src/editor/editor.tseditor/index.tsnext/src/css/patterns/wordpress/theme/patterns/,next/src/components/filters.tsSteps 3–4 of Option B and Step 3 of Option A point at directories that don't exist. The doc also uses a
ramoneurs/namespace and abenefits-list-itemblock that aren't in the repo, and noblock.jsonexists undernext/src/components/custom/, so Step 1's example has no counterpart. Happy to open a separate issue if useful.My section links only to
Blocks.tsx, which does exist.🤖 Generated with Claude Code
https://claude.ai/code/session_01NMQ82izBcjxySfEM7W4nTP