refactor(events): Don't filter events before undo #8537
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The basics
The details
Resolves
Cleanup work adjacent to fixes for #2037 and #8225.
Proposed Changes
filter
function fromWorkspace.prototype.undo
.fireNow
.Reason for Changes
Use of the
filter
function inWorkspace.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 tofireNow
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