Repository navigation
fix: reset Run-scoped UI state on selection changes - #7
Merged
Merged
Conversation
pppolf
marked this pull request as ready for review
August 12, 2026 10:19
This was referenced Aug 15, 2026
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.
What changed
Why
React reused the same workspace component instance when only
runIDorsessionIDchanged. Run-scoped local state—including unsent message drafts, mutation results, cancellation inputs, and in-memory retry/idempotency state—could therefore survive a sidebar selection change. The newly selected resource supplied the next render's API binding, so an old draft could be accidentally submitted to the wrong Run or Session.Keying each top-level workspace by its selected identity makes React tear down the old resource scope before rendering the next one. It also aborts/unsubscribes child effects through their normal cleanup paths.
Impact
Switching between Runs or Sessions now starts with a clean resource-scoped UI. Drafts and uncertain local operation state cannot cross the identity boundary.
Validation
Run with the repository CI Node version (Node 24):
vitest run src/App.test.tsx— 3 passedvitest run— 55 files / 213 tests passedtsc -b --pretty falsenpm run check:apigit diff --check