Skip to content
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

refactor(events): Don't filter events before undo #8537

Merged
merged 1 commit into from
Aug 20, 2024

Conversation

cpcallen
Copy link
Contributor

The basics

The details

Resolves

Cleanup work adjacent to fixes for #2037 and #8225.

Proposed Changes

  • Don't call filter function from Workspace.prototype.undo.
  • Delete post-fire undo/redo queue filtering from fireNow.

Reason for Changes

Use of the filter function in Workspace.prototype.undo was intended to reduce the number of events that would need to be run when undoing or redoing, but because it mutates and sometimes deletes stacked events this has caused problems with repeated undo/redo (see issue #7026). The originally-chosen fix for which was the addition (in PR #7069) of code to fireNow to post-filter the .undoStack_ and .redoStack_ of any workspace that had just been involved in dispatching events; this apparently resolved the issue but added considerable additional complexity and made it difficult to reason about how events are processed for undo/redo.

Instead, since this filtering typically does nothing (at least nothing desirable), simply don't re-filter events on the undo stack before replaying them.

Test Coverage

Although this PR should reduce the overall likelihood of event-mechanics-related problems with undo/redo, those functions should nevertheless be subject to thorough testing before our next release.

Documentation

No changes required.

Additional Information

Use of the filter function in Workspace.prototype.undo has caused
problems with repeated undo/redo (see issue google#7026), the
originally-chosen fix for which was the addition (in PR google#7069) of
code to fireNow to post-filter the .undoStack_ and .redoStack_ of
any workspace that had just been involved in dispatching events.

This apparently resolved the issue but added considerable
additional complexity and made it difficult to reason about how
events are processed for undo/redo.

Instead, since this filtering typically does nothing (at least
nothing desirable), simply don't re-filter events on the undo
stack before replaying them.
@cpcallen cpcallen merged commit bde216d into google:develop Aug 20, 2024
11 checks passed
@cpcallen cpcallen deleted the fix/no-undo-filter branch August 20, 2024 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants