-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
TemplatePanel: Fixed a problem that when a new template is created, the template is not displayed in the select box. #32744
Conversation
…ilableTemplates in editorSettings.
Size Change: +1.05 kB (0%) Total Size: 1.04 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.
Thanks for following-up with this, this is exactly what I had in mind.
I was able to reproduce the problem. The result of Also, should I show a 404 in this selectbox? |
Also, the value of getEditorSettings().availableTemplates is as follows.
It's odd that the key for 404 is |
Feels like there's two different but related issues at play:
I think we can leave the second point for later as FSE themes are not included in 5.8 |
I cannot reproduce this problem. How do I operate? |
@torounit mmm 🤔 trying again, maybe I didn't test properly the first time. |
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.
Nevermind, I might have done something wrong when I first tested. This is working great for me.
There's an e2e test failure, let's see if it's persistent.
Looks like the test failure is consistent and I don't see it on trunk, is this something you can check or would you need help for it? |
@youknowriad Fixed e2e test. |
@@ -103,12 +103,15 @@ describe( 'Post Editor Template mode', () => { | |||
wp.data.dispatch( 'core/block-editor' ).clearSelectedBlock(); | |||
} ); | |||
|
|||
await createNewTemplate( 'Blank Template' ); |
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.
I don't think we should add this here because it changes what the test is about, this test is about testing block-based themes where you can switch to the template mode for default templates as well.
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.
Thanks for reviewing !
If we do not create a new template, the only template that exists is the "Defalut Template". In the case of "Defalut Template", the "Edit" link will not appear, and a timeout will occur. Therefore, we need to create an editable template and link it to the post.
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.
For block-based themes, the default template is editable, and that test switches to "tt1-blocks" in the beginning of the test.
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.
Sorry, I must have misunderstood. I deleted the new template and it passed the test.
@@ -53,7 +53,7 @@ function PostTemplateActions() { | |||
return ( | |||
<> | |||
<div className="edit-post-template__actions"> | |||
{ !! template && ( | |||
{ template !== 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.
Is the change here intentional? What's the reasoning? I'm just trying to think if there are cases where template
could be undefined
?
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.
The one I was verifying the operation of got mixed up.
I will revert to !! template
.
This is working great, 💯 kudos |
After merging this, I noticed that the post-template-editor test is failing on trunk. It's not clear whether it's because of this PR or something else though. Do you think this is something you can help debug @torounit ? |
The problem seems to be coming from 46df095. When I set It seems that we need to think about e2e-testing when the theme does not support |
@youknowriad Opened PR #32904 about the issue of broken e2e-test. |
Great thank you. |
…he template is not displayed in the select box. (#32744)
…he template is not displayed in the select box. (#32744)
Description
related: #32735.
Fixed instead of __unstableSwitchToTemplateMode.
How has this been tested?
Screenshots
Types of changes
Bug fix
Checklist:
*.native.js
files for terms that need renaming or removal).