Command Palette: Fix duplicate enqueue breaking the palette in the Site Editor#79396
Conversation
The site-editor-v2 (and other boot pages) enqueue the Command Palette directly via wp_enqueue_command_palette_assets() in the page template. The /wp-block-editor/v1/assets endpoint also captures core's wp_enqueue_command_palette_assets that remains hooked on admin_enqueue_scripts, so wp-core-commands was loaded a second time, splitting the core/commands store and preventing the palette from opening. Remove the action before the asset capture so the palette is enqueued only once on the page itself. Co-Authored-By: Claude <[email protected]>
|
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. |
|
Flaky tests detected in fb01cb6. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/27947496018
|
|
AFAIK, that endpoint tries to find the scripts/styles that are not loaded yet. I wonder why the command palette assets were not detected as loaded. |
youknowriad
left a comment
There was a problem hiding this comment.
I noticed the command palette button (and focus styles) is cut a bit on the extensible site editor but that's probably a separate regression.
I'm not sure of the cause, but there might be room for improvement in the auto-load logic itself. Perhaps we can eventually remove some of these |
Fixes #79390
What?
Follow up to #79196.
Fixes the Command Palette not opening on the Site Editor (
admin.php?page=site-editor-v2) and other boot-based admin pages.Why?
#79196 dropped the
lib/compat/wordpress-6.9/directory. One of the removed files used to swap core'swp_enqueue_command_palette_assetsout of theadmin_enqueue_scriptshook, and the/wp-block-editor/v1/assetsREST endpoint relied on that.Without it, core's
wp_enqueue_command_palette_assetsstays hooked, and the editor then loadswp-core-commandsa second time, splitting thecore/commandsstore into two instances.initializeCommandPalette()runs, but the palette never opens.How?
Removes the action before the asset capture in
get_assets(), so the Command Palette is enqueued only once — on the page itself.Testing Instructions
Use of AI Tools
Root cause analysis and the fix were assisted by Claude Code. All changes were reviewed by the author.