FSE Design Pack editor notice never shows on WordPress 6.8+ (core renamed the pattern-inserted notice id)
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 77/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- javascript, wordpress
- 领域
- frontend
调研方向
从 assets/js/src/components/DesignPackNotice.js 开始,跟踪在插入 pattern 后它如何读取 Core 通知。比较 issue 中针对 WordPress 6.7 和 6.8+ 描述的通知 ID 和内容,并确保其他 inserter 通知不会触发升级推销。完成标准是:两个版本中插入 pattern 后都会显示该通知,而在无关的插入操作后不会显示。
由索引模型根据 Issue 内容生成。
描述
What's wrong
After you insert a pattern in the editor, Raft 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=raft&login=yes&url=/wp-admin/post-new.php?post_type=page
- ❌ Broken (latest WordPress): https://playground.wordpress.net/?wp=latest&theme=raft&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 raft-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, "Raft 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 (#raft-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. Raft 1.1.17 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/jaxon#119
- Codeinwp/riverbank#132
- Codeinwp/fork#117
- 主要语言
- PHP
- 星标
- 8
- 派生
- 4
- 平均合并
- 7 小时 18 分钟
- 30 天内合并 PR
- 6
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Codeinwp/raft 的其他 Issue
-
feature-request-triage
难度 5/5 一周以上 新手友好度 15/100
-
难度 3/5 1-2 天 新手友好度 25/100
-
bug
难度 3/5 1-2 天 新手友好度 35/100
-
bug customer report
难度 3/5 1-2 天 新手友好度 35/100
-
难度 3/5 1-2 天 新手友好度 35/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 天内回复