-
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
Merely selecting a block after load creates undo level #14766
Comments
The action that grabs my attention is |
I'd need to spend some time investigating to understand, but on hunch I think it's related to one of either reusable blocks triggering gutenberg/packages/block-editor/src/store/reducer.js Lines 178 to 240 in 495f54c
Clicking on a paragraph triggers autocomplete to do the fetch for reusable blocks so that it can populate results in the slash command. |
I seem to be observing that that this "dirties" the post as well, which was intended to be explicitly not the case with the implementation of #13088 . If confirmed, I'd suggest it be prioritized for a fix to be included with the WordPress 5.2 release. As a regression, it should be reasonable to expect and to implement a test as part of the |
There may be separate issues here between how the For the original issue describing undo history, this may in-fact be the expected behavior, or at least there's a specific condition which forces that an undo history entry be created when history is currently empty, even if the action ( gutenberg/packages/editor/src/utils/with-history/index.js Lines 122 to 129 in bb3b77a
...specifically the For change detection, it may be a matter of configuring gutenberg/packages/editor/src/store/reducer.js Lines 144 to 148 in bb3b77a
Looking at the implementation prior to changes in #13088, we seemed to include at least a few gutenberg/packages/editor/src/store/reducer.js Lines 411 to 416 in 4be0a36
It's not immediately clear to me why these were dropped (cc @youknowriad ). |
As an action item, I might propose to consider whether the
I will plan to explore a solution here, specifically seeking to restore the removed |
One possible action which can incidentally serve as a solution: Rather than trigger to fetch reusable blocks immediately upon block selection, the fetch should only occur after some initial typing (i.e. when the autocomplete results are presented). This would help avoid the scenario where the fetch results are the first action dispatched to the editor store. |
Spending more time looking at this, I understand now why I'd wondered then if it would be worth tying this to the Rather, it seems the issue is that we shouldn't expect |
While related, I've split off the problem of change detection to its own issue at #14910, which I've discovered to be affecting more flows than just the block selection (opening an inserter or editing a post containing a reusable block can also trigger the prompt). |
To Reproduce
Expected behavior
I don't expect block selection to create undo levels.
Additional context
I see the following actions when I select a block:
So it looks like it has something to do with reusable blocks fetching? Cc @noisysocks @aduth.
The text was updated successfully, but these errors were encountered: