Skip to content
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

Site Editor: Unexpected "undo" behavior in StrictMode #63167

Open
Mamaduka opened this issue Jul 5, 2024 · 1 comment
Open

Site Editor: Unexpected "undo" behavior in StrictMode #63167

Mamaduka opened this issue Jul 5, 2024 · 1 comment
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Type] Bug An existing feature does not function as intended

Comments

@Mamaduka
Copy link
Member

Mamaduka commented Jul 5, 2024

I noticed unexpected behavior when undoing changes in the Site Editor and React StrictMode is enabled.

After undoing the recently made changes, there are extra history records, and the template part content is gone after the changes are entirely undone. The issue affects unmodified template parts with the Navigation block.

Note

The bug doesn't affect WP 6.6 or production websites running the Gutenberg plugin.

Testing Instructions

  1. Enabled SCRIPT_DEBUG so React code runs in a StrictMode.
  2. Using TT4.
  3. Ensure that the Header template part and template used for testing have no changes. They're loaded from a file.
  4. Open a template like "Page: 404".
  5. Make changes to the content or template part.
  6. Undo the changes.
  7. Notice that there are more "undo" steps than actual changes.
  8. Fully undoing clears out the header template part.

Screencast

CleanShot.2024-07-05.at.10.18.37.mp4
CleanShot.2024-07-05.at.10.20.11.mp4
@Mamaduka Mamaduka added [Type] Bug An existing feature does not function as intended [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") labels Jul 5, 2024
@Mamaduka
Copy link
Member Author

Mamaduka commented Sep 5, 2024

I noticed similar behavior with the File block in the post editor, which updates attributes on the mount.

  1. Enabled SCRIPT_DEBUG so React code runs in a StrictMode.
  2. Insert some content.
  3. Insert a file block and select file.
  4. Disable the "Show download button".
  5. Reload the page.
  6. Notice there's an "Undo" action active.
  7. Undo the changes, and the whole content disappears.

Screencast

CleanShot.2024-09-05.at.08.54.46.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

1 participant