-
Notifications
You must be signed in to change notification settings - Fork 4.8k
"Undo trap": Avoid getting stuck in an editing state #8119
Copy link
Copy link
Closed
Labels
[Feature] Block TransformsBlock transforms from one block to anotherBlock transforms from one block to another[Feature] HistoryHistory, undo, redo, revisions, autosave.History, undo, redo, revisions, autosave.[Feature] Paste[Feature] Writing FlowBlock selection, navigation, splitting, merging, deletion...Block selection, navigation, splitting, merging, deletion...[Type] Tracking IssueTactical breakdown of efforts across the codebase and/or tied to Overview issues.Tactical breakdown of efforts across the codebase and/or tied to Overview issues.
Metadata
Metadata
Assignees
Labels
[Feature] Block TransformsBlock transforms from one block to anotherBlock transforms from one block to another[Feature] HistoryHistory, undo, redo, revisions, autosave.History, undo, redo, revisions, autosave.[Feature] Paste[Feature] Writing FlowBlock selection, navigation, splitting, merging, deletion...Block selection, navigation, splitting, merging, deletion...[Type] Tracking IssueTactical breakdown of efforts across the codebase and/or tied to Overview issues.Tactical breakdown of efforts across the codebase and/or tied to Overview issues.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Undo trap: The situation in which a user is "stuck" when continuously pressing Undo. The typical cause: as Undo is pressed and the content is reverted, some event somewhere causes a new undo level to be created. The result is that the user is unable to undo past a certain point, thereby losing access to previous editing states.
This issue aggregates all bugs stemming from that common problem:
Problem
At the root of these bugs is the fact that blocks need to manage a transition using specific ephemeral state:
[gallery ids="x,y,z"], a Gallery block needs to temporarily keep the IDsx, y, zof the images while it waits for API data necessary to the block (the URL andaltattribute for each image); once it receives the API data, it adds it to its attributes [resolved state];Since the temporary states are encoded in the attributes themselves of the blocks, they automatically constitute an undo level of the editor history. Thus, the action of undoing will bring the blocks back to that temporary state, which itself triggers a transition "back" into the resolved state.
Solutions
There are, as I see it, two approaches:
The first option seems to be worth exploring first. A quick stab at the second one — by hacking
withHistory— doesn't inspire a lot of confidence.