-
Notifications
You must be signed in to change notification settings - Fork 8
Description
Diagnostic info:
- I was using the:
- Plutus PlaygroundMarlowe PlaygroundTo pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel.
- 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:
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:
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
- Open up a project on the marlowe playground.
- Delete some blocks.
- Open the trashcan and observe how the deleted blocks are available.
- Open a new project.
- Open the trashcan and observe how the deleted blocks are still available, even though they should not be.
- 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