Style Book: Fix missing styles for classic themes in stylebook route#76843
Style Book: Fix missing styles for classic themes in stylebook route#76843
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Size Change: +24 B (0%) Total Size: 7.69 MB
ℹ️ View Unchanged
|
|
Flaky tests detected in eabd397. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/23603667509
|
| <StyleBookPreview isStatic /> | ||
| <StyleBookPreview | ||
| isStatic | ||
| settings={ siteData.editorSettings } |
There was a problem hiding this comment.
I'm wondering if it would be better to update editor settings (dispatch( editorStore ).updateEditorSettings( settings );) below the edit site settings update. 🤔
There was a problem hiding this comment.
That approach might also be possible, but it could have a significant impact and be risky to implement during the RC phase 🤔
| const editorSettings = useSelect( | ||
| ( select ) => select( editorStore ).getEditorSettings(), | ||
| [] | ||
| ( select ) => settingsProp ?? select( editorStore ).getEditorSettings(), |
There was a problem hiding this comment.
Do we gain anything by doing the check inside the useSelect and not outside? 🤔
There was a problem hiding this comment.
This is to avoid unnecessary subscriptions to the editorStore when settingsProp exists.
ntsekouras
left a comment
There was a problem hiding this comment.
I think this approach is fine too and we already have siteData available to pass. Thanks!
…76843) * Style Book: Fix missing styles for classic themes Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Avoid unnecessary subscription --------- Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org>
|
I just cherry-picked this PR to the wp/7.0 branch to get it included in the next release: 57ca43e |
Fixes #76826
What?
Fix the Style Book not applying any styles when opened via the stylebook route with a classic theme
Why?
When
StyleBookPreviewwas moved fromedit-sitetoeditorpackage in #72681, the settings source changed fromsiteEditorStore.getSettings()toeditorStore.getEditorSettings(). For the classic theme stylebook route, no post is being edited, soEditorProvideris not rendered andeditorStore.editorSettingsis never initialized with the theme's styles — resulting in a completely unstyled Style Book.How?
settingsprop toStyleBookPreviewthat takes precedence overeditorStore.getEditorSettings()when provided.siteData.editorSettings(fromeditSiteStore.getSettings(), which contains the theme styles) toStyleBookPreview.Testing Instructions
Screenshots
Before
After
Use of AI Tools
Claude Code was used to investigate the regression and implement the fix.