Skip to content

Command Palette: Fix duplicate enqueue breaking the palette in the Site Editor#79396

Merged
t-hamano merged 2 commits into
trunkfrom
fix/command-palette-duplicate-assets
Jun 22, 2026
Merged

Command Palette: Fix duplicate enqueue breaking the palette in the Site Editor#79396
t-hamano merged 2 commits into
trunkfrom
fix/command-palette-duplicate-assets

Conversation

@t-hamano

@t-hamano t-hamano commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

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's wp_enqueue_command_palette_assets out of the admin_enqueue_scripts hook, and the /wp-block-editor/v1/assets REST endpoint relied on that.

Without it, core's wp_enqueue_command_palette_assets stays hooked, and the editor then loads wp-core-commands a second time, splitting the core/commands store 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

  1. Enable the Extensible Site Editor experiment.
  2. Open the site editor.
  3. Press Cmd/Ctrl+K.
  4. The Command Palette opens.

Use of AI Tools

Root cause analysis and the fix were assisted by Claude Code. All changes were reviewed by the author.

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]>
@t-hamano t-hamano self-assigned this Jun 22, 2026
@t-hamano t-hamano added [Type] Bug An existing feature does not function as intended [Feature] Command Palette labels Jun 22, 2026
@t-hamano t-hamano requested review from Mamaduka and youknowriad June 22, 2026 10:51
@t-hamano t-hamano marked this pull request as ready for review June 22, 2026 10:52
@github-actions

github-actions Bot commented Jun 22, 2026

Copy link
Copy Markdown

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: t-hamano <[email protected]>
Co-authored-by: youknowriad <[email protected]>
Co-authored-by: fushar <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions

Copy link
Copy Markdown

Flaky tests detected in fb01cb6.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/27947496018
📝 Reported issues:

@youknowriad

Copy link
Copy Markdown
Contributor

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 youknowriad 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.

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.

@t-hamano

Copy link
Copy Markdown
Contributor Author

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.

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 remove_actions. Let's consider essential improvements in a follow-up.

@t-hamano t-hamano merged commit 50bf905 into trunk Jun 22, 2026
40 of 41 checks passed
@t-hamano t-hamano deleted the fix/command-palette-duplicate-assets branch June 22, 2026 14:20
@github-actions github-actions Bot added this to the Gutenberg 23.5 milestone Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Command Palette [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extensible Site Editor: Command palette not working

2 participants