Skip to content

Switching projects does not clear workspace state - Marlowe blocks editor #70

@BeksOmega

Description

@BeksOmega
Contributor

Diagnostic info:

  • I was using the:
    • Plutus Playground
      Marlowe Playground
  • Link to gist with saved setup that reproduces the issue: N/A

Description

When you switch projects you expect that nothing should be "left over" from the previous project, but this is not the case. For example the trashcan still contains deleted blocks from the previous project:
trashcan-leaking

And the blockly undo stack still has actions from the previous project. See how I can use undo to get the blocks from the first project into the second:
events-leaking

This may not seem bad now, but in the future if you want to restrict blocks so that they are only available under certain circumstances, this could cause you major problems.

Steps to reproduce

  1. Open up a project on the marlowe playground.
  2. Delete some blocks.
  3. Open the trashcan and observe how the deleted blocks are available.
  4. Open a new project.
  5. Open the trashcan and observe how the deleted blocks are still available, even though they should not be.
  6. Press undo continually until you get back to the state of the previous project. Observe how this should not be possible.

Suggested solution

The simplest thing to do is just dispose of the old workspace and re-inject it whenever you switch projects. This makes sure that all event listeners, collections, and other state get cleaned up properly. Plus it's pretty simple.

Alternative solution

Alternatively you could try to keep track of all the state that needs to get cleaned up yourself. Eg, clearing the undo & redo stacks, cleaning up the trashcan state, etc. But I think that with this solution you'll inevitably miss things.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @palas@BeksOmega

      Issue actions

        Switching projects does not clear workspace state - Marlowe blocks editor · Issue #70 · marlowe-lang/marlowe-playground