-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Query Title block: Rely on the editor store to apply the right archive title placeholder. #63478
Conversation
…e title placeholder
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. |
templateId | ||
)?.slug | ||
: null; | ||
}, [] ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Above this line is the new addition. The rest is the same as before.
Size Change: -1 B (0%) Total Size: 1.75 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1- Create tag archive block template
2- Make the sure the title shows the right placeholder: "Tag: name".
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. The only visible change though is that since the hook is inside the block's edit function, there is the quick flash updates of titles, when the selector has resolved. Should we wait for the resolution? 🤔
I don't really understand why it's different in terms of loading than trunk, we're calling the exact same selectors. 🤔 |
I see now, It's actually the same as before, only difference is the "global loading" was taking the resolver into consideration and in this PR it's not. I'm guessing because the block is rendered after some "ticks". Going to merge now I guess but we can look at improving that if needed. |
…e title placeholder (#63478) Co-authored-by: youknowriad <youknowriad@git.wordpress.org> Co-authored-by: jameskoster <jameskoster@git.wordpress.org> Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org>
…e title placeholder (WordPress#63478) Co-authored-by: youknowriad <youknowriad@git.wordpress.org> Co-authored-by: jameskoster <jameskoster@git.wordpress.org> Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org>
This is the first step to solve this but #59082
What?
This PR refactors the way the Query Title block retrieves the current template in order to change the placeholder contextually. Instead of relying on a random block editor setting, it relies on the actual template used in the "core/editor" store directly.
The reason we can do this is because some blocks of block-library are WP specific and can actually make use of the editor package. It's the case for the Query Title block.
Testing Instructions
1- Create tag archive block template
2- Make the sure the title shows the right placeholder: "Tag: name".