-
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
Bogus undo and unsaved changes state #34802
Comments
I think this "side effect" causes the issue. If I comment out the gutenberg/packages/block-library/src/navigation-link/edit.js Lines 366 to 373 in 639a603
Is it possible for /cc @talldan. |
You're right, it doesn't seem to be working in the navigation editor. I'm not sure why that would be though. Looking into it. An option might just be to get rid of |
I'm not sure about Side note: If we end up keeping |
So there are a couple of differences between the post editor and the nav editor in terms of this issue: 1. Block is loaded differentlyIn the post editor 2. Nav editor behaves slightly differently to the post editor in adding things to the undo stack.The reducer that adds things to the undo stack works slightly differently in the post editor. There, changes to blocks are considered 'transient' edits, and the edit is flattened onto the previous item: gutenberg/packages/core-data/src/reducer.js Lines 448 to 464 in 79be738
This is defined in the entities definition, like this one for widgets: gutenberg/packages/core-data/src/entities.js Lines 71 to 79 in 79be738
I don't think the nav editor has a definition for its 'stub' navigation post entity, so maybe it needs one and to define block edits as transient. |
Thanks for the detailed explanation. The Widget editor also uses an in-memory post entity but does have the same issue. |
Just testing the widget editor, it does indeed have the same issue. Preventing the nav block from serialising I've put together a fix in #34839, but it introduces another issue. (edit: now fixed) |
Problem
When you open the Navigation Editor or reload the page after saving (CMD + R), the page is displayed if you have unsaved changes. It also shows the active "Undo" button, which does nothing.
Screencast
CleanShot.2021-09-14.at.13.11.37.mp4
The text was updated successfully, but these errors were encountered: