WordPress / WordPress/gutenberg
Template Part: Better handling of "missing" parts
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 11.8k
- Forks
- 4.9k
- PR merge metrics
- PR metrics pending
Description
What problem does this address?
When a template part block references a part that is missing, you see the following error on the canvas:
It's okay for theme developers, but when an end-user encounters this it's not super helpful. It's not something folks are likely to encounter now, but as we enrich the template creation flow, and the pattern directory expands to include template-specific patterns, it might start to crop up more often.
It might be nice to explore some actionable items we could add to the message, and in some circumstances avoid showing the message at all.
What is your proposed solution?
A couple of ideas off the top of my head
- Update the view above to include a "Choose" button which opens a modal containing options (local and from the pattern / theme directory)
- When creating a template (either by manually pasting in the blocks, or via the built-in flows) if a missing part is referenced, automatically swap it out for a local equivalent of the same semantic area, and display a confirmational Snackbar.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files or tests are named. Start by reproducing the missing template-part error on the editor canvas and tracing the template-part block flow. Compare the proposed Choose modal and automatic local replacement ideas, then define a single actionable behavior and its confirmation or suppression state before identifying the relevant tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100