Make WordPress Core

Opened 2 years ago

Last modified 5 weeks ago

#61347 new defect (bug)

Swapping templates hangs site

Reported by: mattpettefer Owned by:
Priority: normal Milestone: Awaiting Review
Component: Editor Version: 6.5.3
Severity: normal Keywords: needs-patch reporter-feedback
Cc: Focuses: template, rest-api

Description (last modified by poena)

After selecting a different template, the entire site hangs for over a minute with disabled update button before "Updating..." begins.

There are no errors other than some assets being served over http rather than https from plugins. On the occasion that a template had a block error, the behavior was exactly the same as when there are no errors in the template. Same whether there is a template part in the template or not.

Template example:

<!-- wp:template-part {"slug":"header","tagName":"header", "className": "site-header2020"} /-->
<!-- wp:group {"tagName":"main","layout":{"type":"constrained"}} --><main class="wp-block-group">

    <!-- wp:post-content {"className":"legacy-post-padding"} /-->

</main><!-- /wp:group -->

Theme.json snippet:

"customTemplates": [
		{
			"name": "page-no-title",
			"postTypes": ["page"],
			"title": "Page No Title"
		},
		{
			"name": "page-with-sidebar",
			"postTypes": ["page"],
			"title": "Page with Sidebar"
		},
		{
			"name": "page-wide",
			"postTypes": ["page"],
			"title": "Page with Wide Image"
		},
		{
			"name": "single-with-sidebar",
			"postTypes": ["post"],
			"title": "Single with Sidebar"
		},
		{
			"name": "single-academic-pages-legacy",
			"postTypes": ["academic-pages"],
			"title": "Academics Pages Legacy Padding"
		},
		{
			"name": "single-academic-pages-legacy-header",
			"postTypes": ["academic-pages"],
			"title": "Academics Pages Legacy Header"
		},
		{
			"name": "single-academic-pages-w-title",
			"postTypes": ["academic-pages"],
			"title": "Academics Pages with Title - M.S."
		}

	]

Change History (4)

#1 @mattpettefer
2 years ago

To clarify, the button doesn't break the first time templates are switched - update needs to be clicked but it still hangs for 30 - 60 secs and then taked 1+ minute to update.

This is not the case if I leave the page on the default template.

#2 @poena
2 years ago

  • Description modified (diff)

#3 @poena
2 years ago

  • Keywords reporter-feedback added

Hi @mattpettefer

Does this happen on all post types or only the custom post types?
Does it happen without custom plugins and with a default theme active?

Can you share the information about the site configuration? You can copy the information from Site Health.

#4 @abhishekfdd
5 weeks ago

Reproduction Report

Environment:

  • WordPress: 6.5.3 and trunk (7.2-alpha-64298)
  • PHP: 8.3
  • Server: WordPress Playground (SQLite)
  • Browser: Chromium (headless)
  • Theme: custom block theme replicating the description (same template markup, header template part, all 7 customTemplates from the theme.json snippet)
  • Plugins: none, plus an mu-plugin registering an academic-pages CPT

Steps:

  1. Open a page / academic-pages post in the editor.
  2. Template > Swap template (Change template on trunk) > pick another custom template.
  3. Click Update.

Results:

  • Update button re-enables ~200ms after selecting a template.
  • Save completes in 1 to 2s (same as a title-only save in this environment), template persists.
  • Same result for pages, posts and the custom post type, and on a second consecutive swap.

Could not reproduce on 6.5.3 or trunk. This points to something site-specific (plugin hooks on save, caching, slow REST responses). Without the requested Site Health info this is hard to move forward; suggest closing as worksforme unless @mattpettefer can reproduce with plugins disabled and a default theme.

Note: See TracTickets for help on using tickets.