Skip to content

usePostActions: avoid theme fetch for non template part types #70536

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from

Conversation

ellatrix
Copy link
Member

@ellatrix ellatrix commented Jun 26, 2025

What?

A bit related to #70535, this one avoids a request for the current theme if it's not needed. It's only needed for template parts.

Why?

How?

Testing Instructions

  • Go to Site Editor > Patterns > Template Parts, and check that duplication is still available.

Testing Instructions for Keyboard

Screenshots or screencast

Before After

Copy link

github-actions bot commented Jun 26, 2025

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: ellatrix <[email protected]>
Co-authored-by: Mamaduka <[email protected]>

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

@ellatrix ellatrix added the [Type] Performance Related to performance efforts label Jun 26, 2025
@Mamaduka
Copy link
Member

An interesting optimization, but I'm having trouble finding the requests for the /themes endpoint in Editors. The active themes record used by getCurrentTheme is preloaded, so unless there's some race condition, the selector shouldn't trigger the HTTP request.

P.S. Wouldn't the same unconditional resolve select above your changes already trigger a resolution?

const currentTheme = await registry
.resolveSelect( coreStore )
.getCurrentTheme();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Performance Related to performance efforts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants