Skip to content

Fix Show Template course layouts and remove the legacy template warning - #8139

Merged
donnapep merged 3 commits into
trunkfrom
fix/show-template
Aug 7, 2026
Merged

donnapep merged 3 commits into
trunkfrom
fix/show-template

Conversation

@donnapep

@donnapep donnapep commented Aug 7, 2026 •

Copy link
Copy Markdown
Member

Resolves SEN-109.
Fixes #8103.

Proposed Changes

  • Load Sensei patterns independently of the active block-editor canvas.
  • Share the same pattern-loading logic between the layout picker and default-layout insertion.
  • Use the post type’s registered template to determine the default pattern.
  • Reset the complete post content through the editor store.
  • Detect nested Sensei blocks from the complete editor block tree when toggling legacy metaboxes.
  • Remove the “It looks like this course page doesn’t have any Sensei blocks” notice.
  • Add regression tests for pattern loading, parsing, deduplication, layout selection, default-layout insertion, and nested block detection.

Root cause

With Show template enabled, WordPress scopes core/block-editor selectors 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-data and complete post content from the editor store.

Testing Instructions

  • Open an existing course. In the Course settings sidebar, find Template, open Template options, and select Show template.
  • Navigate to Courses → New Course.
  • Enter a course title and description, then click Continue.
  • Confirm that Course Default, Video Hero, Long Sales Page, and Life Coach appear.
  • Select a layout and confirm its blocks are added to the course.
  • Repeat the flow, but close the wizard after entering a title and description.
  • Confirm that the default layout is added and contains the entered description.
  • Start with a blank canvas or remove all Sensei blocks, then confirm the “It looks like this course page…” notice is not displayed.

@donnapep donnapep added this to the 4.26.3 milestone Aug 7, 2026
@donnapep donnapep self-assigned this Aug 7, 2026
Copilot AI review requested due to automatic review settings August 7, 2026 15:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 (from core-data) to pick the default pattern and reset the post content via editor store 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.

Comment thread assets/js/admin/blocks-toggling-control.js Outdated
Comment thread assets/admin/editor-wizard/patterns-list.test.js Outdated
@github-actions

github-actions Bot commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

WordPress Playground Preview

The changes in this pull request can previewed and tested using a WordPress Playground instance.

Open WordPress Playground Preview

@donnapep
donnapep merged commit 35f8f54 into trunk Aug 7, 2026
25 checks passed
@donnapep
donnapep deleted the fix/show-template branch August 7, 2026 16:40
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.

"Show Template" enabled breaks Sensei block loading

2 participants