Skip to main content
GoodFirstPicks
DashboardIssuesReposLeaderboard

GoodFirstPicks by Leaveitblank © 2026

CreatorRequest a RepoPrivacy PolicyTerms of Service
Site Editor: Unexpected "undo" behavior in StrictMode | GoodFirstPicks

Site Editor: Unexpected "undo" behavior in StrictMode

WordPress/gutenberg 3 comments 1mo ago
View on GitHub
mediumopenScope: somewhat clearSkill match: maybeTest focusedWordPressJavaScriptReact

Why this is a good first issue

Issue involves React StrictMode-specific behavior and undo functionality in the Site Editor.

AI Summary

The issue describes unexpected undo behavior in the Site Editor when React StrictMode is enabled, leading to extra history records and cleared template part content. Testing instructions are provided, but the issue may involve deeper React lifecycle or state management concerns. A potential fix (#73378) is mentioned but requires verification.

Issue Description

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

https://github.com/WordPress/gutenberg/assets/240569/3684a74c-9f79-4af8-b9eb-f770dede21dc

https://github.com/WordPress/gutenberg/assets/240569/fa50dc77-b086-4984-ab9f-360cc2d49acb

GitHub Labels

[Type] Bug[Feature] Site Editor

Want to work on this?

Claim this issue to let others know you're working on it. You'll earn 20 points when you complete it!

Risk Flags

  • StrictMode-specific
  • potential cross-cutting issue
Loading labels...

Details

Points20 pts
Difficultymedium
Scopesomewhat clear
Skill Matchmaybe
Test Focusedyes