-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
[History]: Fix redo after update/publish with transient edits #37840
[History]: Fix redo after update/publish with transient edits #37840
Conversation
@@ -164,15 +168,14 @@ describe( 'Template Revert', () => { | |||
expect( contentBefore ).toBe( contentAfter ); | |||
} ); | |||
|
|||
it.skip( 'should show the original content after revert, clicking undo then redo in the header toolbar', async () => { | |||
it( 'should show the original content after revert, clicking undo then redo in the header toolbar', async () => { |
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.
Other changes in this file are not relevant to the PR, but refactored a bit (correct function signatures, etc..).
Size Change: -11 B (0%) Total Size: 1.13 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.
While this works, I personally don't understand the logic of that reducer, it's a bit hard to follow.
That's so true 😄 . I have other issues about history in my queue and I hope I'll be in a good place soon to try to simplify things there if there is room for it. |
Sorry, I'm a little bit late. I tested PR, and it works as expected.
I also want to echo the same sentiment 😄 |
It feels like we should back port this one, no? --cc @noisysocks |
I added this to the next "minor" as it doesn't seem that critical and I have set another redo bug similarly. |
* [History]: Fix redo after update/publish with transient edits * test
Fixes: #37195
Maybe related: #37760
Investigation started with @youknowriad 's: #37446 (comment).
When we
save
we do not create an undo step in history and was implemented In this PR. With that in place when we have transient edits and update/publish, if weundo
we cannotredo
then, as in that case we use the last action(save
) which is deliberately handled to return early withfake
noedits
.This PR handles this case to follow the normal flow we have for transient edits.
We create transient edits when we update the same block attribute as in the previous action and also when we use
__unstableMarkNextChangeAsNotPersistent
in a block for some initialization purposes in the first render. The latter case was the reason for the failing test withempty theme
. Inempty theme
's index.html file we hadn't setperPage
and there is logic there to set this value. So when wereverted the template
, the Query Loop's rendering created transient edits. So after saving we had the above problem.Testing instructions
Paragraph
andupdate/publish
.redo
undo
is available and working as expectedBefore
before.mov
After
after.mov
I'd appreciate good testing here for any regression 😄