You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
Diagnostic info:
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
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.
The text was updated successfully, but these errors were encountered: