Automattic / wp-calypso

The JavaScript and API powered WordPress.com
https://developer.wordpress.com
GNU General Public License v2.0
12.4k stars 1.98k forks source link

Rename the custom template all content in template will remove #90379

Closed Mfarroq1 closed 1 week ago

Mfarroq1 commented 4 months ago

Quick summary

If we use the full site editor to create a custom template and then rename it, all the content within the template gets automatically removed. I've been able to replicate this issue with an active Premium plan.

Steps to reproduce

  1. Enable a theme that supports the Full Site Editor feature.
  2. Create a custom template, add content, and save the changes.
  3. Upon renaming the template, all content is automatically removed.
  4. Refresh the page if you don't see any change.

What you expected to happen

After renaming the template, the content should remain unchanged.

What actually happened

The content is removed automatically. here is the video recording to show the exact issue. https://somup.com/cZhi6P5q64

Impact

One

Available workarounds?

Yes, easy to implement

Platform (Simple and/or Atomic)

No response

Logs or notes

No response

Mfarroq1 commented 4 months ago

I have suggested the user to copy the content before renaming the template and after that paste the content again as a workaround.

zen-8154286

liviopv commented 3 months ago

📌 REPRODUCTION RESULTS

📌 FINDINGS/SCREENSHOTS/VIDEO I wasn't able to replicate on Simple or Atomic using Twenty Twenty Four:

https://github.com/Automattic/wp-calypso/assets/14153300/8d129590-43dc-4b3c-8ec8-71a7b6eeb3b2

https://github.com/Automattic/wp-calypso/assets/14153300/5f3c6ba3-cb1b-4f1b-9690-5e77bc0c35df

I also tested using the user's theme, but I couldn't replicate either.

📌 ACTIONS

📌 Message to Author @Mfarroq1 can you look at the videos above and let me know what I am missing?

kthxhi commented 3 months ago

liviopv:

Not OP, but I'm experiencing the same bug (Bitácora theme fwiw).

The bug doesn't occur when I replicate your steps, because it seems to only occur when renaming existing templates. Freshly created templates can be renamed without issue.

For existing templates, it doesn't matter if I edit from the templates list page (Appearanceâžž Editorâžž Templatesâžž list "â‹®"âžž Rename) or from the Editor like you show. It erases everything. When I rename within the Editor, the 'Choose A Pattern' popup window instantly opens.

liviopv commented 3 months ago

Thanks @kthxhi

When you say "because it seems to only occur when renaming existing templates", what are you referring to as "existing templates"? Templates that are bundled with the theme? Or custom templates that have been created for a little while?

kthxhi commented 3 months ago

@liviopv,

A freshly created template (opened in the block editor for the first time) can be renamed within the editor just fine.

But once I've saved that template and exited the block editor, any attempts to rename it will result in a total loss of content.

My theme's stock templates cannot be renamed. I'm not sure if that's true of all themes. LMK if you need more info!

Mfarroq1 commented 3 months ago

@liviopv Apologies for the delayed response. I've confirmed that the issue persists with the twenty-twenty four theme as well. To reproduce the problem, simply change the template name, save the changes, and then refresh the page. Upon doing so, all content disappears. I've prepared a new video demonstration for you. https://somup.com/cZhri15A1s

Mfarroq1 commented 3 months ago

Furthermore, I've encountered the identical issue with newly generated templates as well. The steps to reproduce are straightforward: 1. After creating the template, refresh the page. 2. Modify the template name. 3. Refresh the template name once more. If you're able to reproduce the issue, try changing the the template name for a second time after refreshing the page. You'll undoubtedly encounter the problem. (The aforementioned video was crafted on the Atomic site.)

mrfoxtalbot commented 2 months ago

I can still replicate this using Gutenberg 6.6 RC1

https://github.com/Automattic/wp-calypso/assets/4452464/b22f0af5-2128-4695-b08e-b1239bd2ee79

Restoring a revision of the template fixes the issue.

https://github.com/Automattic/wp-calypso/assets/4452464/66a03911-9ed3-440f-97be-e7de325a3c2b

This is ONLY happening in dotom (simple and Atomic).

On self-hosted, WordPress 6.5.5 with or without the Gutenberg plugin 18.6.1 works fine.

mrfoxtalbot commented 2 months ago

I have shared this in p1719922021469169-slack-C02FMH4G8

alshakero commented 2 months ago

This is a core issue, sent a fix here: https://github.com/WordPress/wordpress-develop/pull/6955

alshakero commented 2 months ago

Thank you so much for the beautiful bug report!! Top notch reporting, much appreciated.

dsas commented 2 weeks ago

This fix has been deployed to simple sites for a while, atomic is still affected though until 6.6.2 is released and deployed. The upstream release is scheduled for September 10th.

ellatrix commented 1 week ago

Can this be closed?

mrfoxtalbot commented 1 week ago

Yup, this is fixed now. Thank you @dsas!

https://github.com/user-attachments/assets/f40e1e96-a7e3-4407-a832-32cc6dc22099