FSE Design Pack editor notice never shows on WordPress 6.8+ (core renamed the pattern-inserted notice id)
還沒有人認領這個 Issue。
評估
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 78/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- javascript, wordpress
- 領域
- frontend
研究方向
從 assets/js/src/components/DesignPackNotice.js 開始,檢查它如何讀取 Core 編輯器通知並比對其 ID。在 WordPress 6.8 或更新版本中重現此問題,接著將通知內容和 ID 與此處描述的 6.3–6.7 行為進行比較。完成標準是:在這些版本中插入 pattern 後會顯示 upsell,但對於插入圖片等無關的 inserter 通知則不會顯示。
由索引模型根據 Issue 內容生成。
描述
What's wrong
After you insert a pattern in the editor, Fork is supposed to show its "FSE Design Pack" upsell notice. Since WordPress 6.8 that notice never shows. Nothing errors and nothing is logged. It just doesn't appear.
The cause: assets/js/src/components/DesignPackNotice.js waits for a core notice with the id block-pattern-inserted-notice:
const BLOCK_PATTERN_INSERTED_NOTICE = 'block-pattern-inserted-notice';
// ...
.getNotices().filter( ( n ) => n.id === BLOCK_PATTERN_INSERTED_NOTICE ).length > 0
Core's block editor used that id from WordPress 6.3 to 6.7. From 6.8 onwards it uses inserter-notice for the same pattern-inserted snackbar (checked in the 6.8.1, 7.0.7 and 7.1.5 builds of wp-includes/js/dist/block-editor.js). So the theme waits for a notice that never comes.
Steps to reproduce
The quickest way to see it is side by side: one Playground where the notice works, one where it doesn't. Both sites are fresh, so the FSE Design Pack plugin isn't installed and the notice has never been dismissed.
- ✅ Works (WordPress 6.7): https://playground.wordpress.net/?wp=6.7&theme=fork&login=yes&url=/wp-admin/post-new.php?post_type=page
- ❌ Broken (latest WordPress): https://playground.wordpress.net/?wp=latest&theme=fork&login=yes&url=/wp-admin/post-new.php?post_type=page
In each one:
- Wait for the page editor to load. Collapse Playground's dark toolbar at the bottom (the ⌄ arrow next to "Autosaved"). The notice appears in the bottom-right corner, and the toolbar covers most of it.
- Click the blue + (Block Inserter) at the top left, open the Patterns tab, then pick a pattern category (the theme's own category, or any other).
- Click a pattern to insert it. Click it rather than dragging it onto the canvas: the theme only reacts to core's "pattern inserted" snackbar, and these steps were checked with a click.
On an existing site: the notice is skipped if the FSE Design Pack plugin is active, or once it has been dismissed. Dismissing it sets the option fork-design-pack-dismissed to yes. Delete that option, or use a fresh site.
Expected (what you see on 6.7)
About half a second after you insert the pattern, a white card slides in at the bottom right: the theme logo, "Fork recommends", "FSE Design Pack: Access a collection of 40+ layout patterns ready to import to your website", a blue Learn More button and an ×. Core's black "Block pattern "…" inserted." snackbar shows at the bottom left at the same time.
Actual (WordPress 6.8 and newer)
Core's snackbar shows (on 6.8+ it reads "Pattern "…" inserted."), but the card never appears. Nothing shows in the console, and the notice container (#fork-design-pack-notice) stays empty. The theme does load its script: window.designPackNoticeData is defined.
Found with Jaxon 1.0.13 on WordPress 7.1.5 (wp-env) and checked in Playground on 6.7 against the latest WordPress. Fork 1.0.16 has the same DesignPackNotice.js code on its default branch.
Suggested fix
Accept both ids, so it keeps working on 6.3 to 6.7 as well:
const PATTERN_NOTICE_IDS = [ 'block-pattern-inserted-notice', 'inserter-notice' ];
// ...
.filter( ( n ) => PATTERN_NOTICE_IDS.includes( n.id ) )
⚠️ Caveat: on 6.8+, core also uses inserter-notice for other inserter snackbars, such as "Image inserted.", "Image uploaded and inserted.", "Block "%s" can't be inserted." and the gallery attach/detach messages. Matching the id alone would also show the upsell after inserting an image. If the notice should only follow a pattern insertion, also check the text when the id is inserter-notice. For example, build a matcher from the same translated string core uses (__( 'Pattern "%s" inserted.' ) resolves through the shared default text domain):
const [ before, after ] = __( 'Pattern "%s" inserted.' ).split( '%s' );
const isPatternNotice = ( n ) =>
n.id === 'block-pattern-inserted-notice' ||
( n.id === 'inserter-notice' &&
typeof n.content === 'string' &&
n.content.startsWith( before ) &&
n.content.endsWith( after ) );
Same bug in the other FSE themes
- Codeinwp/neve-fse#214
- Codeinwp/raft#203
- Codeinwp/jaxon#119
- Codeinwp/riverbank#132
- 主要語言
- PHP
- 星號
- 0
- 分支
- 0
- 平均合併
- 1 小時 2 分鐘
- 30 天內合併 PR
- 5
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 沒有貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
Codeinwp/fork 的其他 Issue
-
難度 1/5 1 小時以內 新手友好度 92/100
-
難度 1/5 1 小時以內 新手友好度 88/100
-
難度 1/5 1 小時以內 新手友好度 86/100
-
難度 2/5 1-3 小時 新手友好度 82/100
-
難度 2/5 1-3 小時 新手友好度 78/100
相似的 Issue
-
Change: check an identifier filter the same way in every tool - the order of somcp_search_orders未關閉consistency enhancement Orders
難度 1/5 1 小時以內 新手友好度 88/100
novalo-dev/Prestashop-MCP-Server#343 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 1 天內回覆
-
claude
難度 2/5 1-3 小時 新手友好度 72/100
sprain/sprainocchio#45 ·
維護者通常 1 天內回覆
-
sync-en
難度 1/5 1 小時以內 新手友好度 85/100
維護者通常 1 天內回覆
-
sync-en
難度 1/5 1 小時以內 新手友好度 85/100
維護者通常 1 天內回覆