Skip to content

Conversation

@cpcallen
Copy link
Collaborator

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 RaspberryPiFoundation#7026), the
originally-chosen fix for which was the addition (in PR RaspberryPiFoundation#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 RaspberryPiFoundation:develop Aug 20, 2024
@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