Fix Show Template course layouts and remove the legacy template warning - #8139
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes Sensei editor-wizard layout/pattern loading and Sensei-block detection when WordPress “Show template” is enabled, by avoiding selectors scoped to the active template canvas and instead using canvas-independent pattern data plus the complete editor block tree.
Changes:
- Load Sensei patterns via
core-data+ editor settings, dedupe them, and parse serialized pattern content in one shared helper (useSenseiPatterns/getSenseiPatterns). - Use the post type’s registered
template(fromcore-data) to pick the default pattern and reset the post content viaeditorstore dispatch. - Update metabox toggling to detect nested Sensei blocks from the full editor block tree and remove the legacy “no Sensei blocks” warning notice; add Jest coverage for these behaviors.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| changelog/fix-show-template-editor-wizard | Patch changelog entry describing the Show template fix. |
| assets/js/admin/blocks-toggling-control.js | Switch block detection to traverse the full editor block tree; remove legacy warning notice logic. |
| assets/js/admin/blocks-toggling-control.test.js | Add unit tests for nested-block detection helper. |
| assets/admin/editor-wizard/patterns-list.js | Replace canvas-scoped pattern lookup with shared Sensei pattern hook. |
| assets/admin/editor-wizard/patterns-list.test.js | Add tests validating pattern loading/parsing and selection behavior. |
| assets/admin/editor-wizard/helpers.js | Introduce shared Sensei pattern retrieval/dedup/parsing and default-pattern selection via post type template. |
| assets/admin/editor-wizard/helpers.test.js | Add regression tests for Sensei pattern filtering/parsing/dedup and default-pattern behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
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.
Resolves SEN-109.
Fixes #8103.
Proposed Changes
Root cause
With Show template enabled, WordPress scopes
core/block-editorselectors to the active template canvas. Sensei used those selectors to find patterns, insert the default layout, and detect Sensei blocks.As a result, the wizard could receive no layouts, default blocks could fail to load, and nested Sensei blocks could be missed.
The fix uses canvas-independent pattern data from
core-dataand complete post content from the editor store.Testing Instructions