-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Undo/redo trap in the navigation block #34564
Comments
This effect seems to be what causes the extra undo level when adding navigation links: gutenberg/packages/block-library/src/navigation-link/edit.js Lines 357 to 358 in f0e66a1
When undoing the addition of a Page Link block, the following steps happen
I debugged this using redux dev tools, but a really easy way to see this is to do the following:
|
Out of interest, I commented out the line that sets the I don't really know what this code does. The comment above the line says 'Store the colors from context as attributes for rendering', but that doesn't seem to be what the code does. 🤔 |
I'm think I have an understanding of this now:
This is in essence the same thing as if a user clicks the undo button a bunch of times and then makes some changes manually, you lose the ability to 'redo', but here the code is causing this. I now remember fixing the same problem in the gallery block (#26377) using the mysterious |
Thanks @talldan for fixing this one! |
Description
Observed by @getdave in #34533 (review).
Undo doesn't work as smoothly as it could often requiring mores steps than needed to undo.
It's also not possible to 'redo' adding link blocks.
I search for previous reports of this problem, #33911 may be related to this.
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
No response
Environment info
Latest Gutenberg trunk.
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: