Repository navigation
Clear the last workspace's output, problems and undo history on a switch - #39
Merged
Merged
Conversation
Running Blink, going Home and starting a blank project left Blink's "Hello World" in the Serial Monitor. The bottom panes and the canvas outlive the workspace they show: the logs, Problems and the undo history are app-wide state that nothing reset when another workspace opened, so the new project also listed the old compile errors, and ⌘Z could replay the old circuit's edits onto the new one. WorkspaceSessionReset (lib/app/) watches the workspace path and, when it changes, clears every log channel (Serial Monitor, and the Serial Plotter drawn from it; SPICE Logs; Debug Console), Problems and the canvas's undo history. The path changes on every switch: templates and blank projects open in fresh temporary folders, another folder has its own path, and Close Folder sets it to null. It lives at the app layer because the state it clears belongs to features that may not import one another. Already reset elsewhere, so left alone: a running simulation stops on a workspace change, and the editor's tabs close as a workspace opens. The terminal is not tied to the workspace, and ending its shell would end whatever runs in it. Tested: switching or closing clears all of it; working within one workspace keeps it. With the reset disabled, the switch tests fail. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Bug: run the Blink template, go Home, start a blank project, and the Serial Monitor still shows Blink's "Hello World". The bottom panes and the canvas outlive the workspace they show: the logs, Problems and the canvas undo history are app-wide state that nothing reset when another workspace opened. So the new project also listed the old compile errors, and ⌘Z could replay the old circuit's edits onto the new one.
Fix:
WorkspaceSessionReset(lib/app/, mounted inbootstrap.dart) watches the workspace path and, when it changes, clears:HistoryManager.clear()).The path changes on every switch: templates and blank projects open in fresh temporary folders, another folder has its own path, and Close Folder sets it to null. It's at the app layer because the state it clears belongs to features that may not import one another (
test/architecture/layering_test.dart).Already handled, left alone:
simulation_bindings.dart);The terminal isn't tied to the workspace (its shell doesn't start in the project), and ending it would end whatever is running in it.
Tests (
test/app/workspace_session_reset_test.dart):With the reset disabled, the two switch tests fail. The full suite passed in pre-push, and
dart analyze --fatal-infosis clean.🤖 Generated with Claude Code