fix(desktop): remote server switching#17214
Open
OpeOginni wants to merge 8 commits intoanomalyco:devfrom
Open
Conversation
…h to properly reset SDK and SSE state
…to explain its use
Contributor
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
Brendonovich
approved these changes
Mar 13, 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.
Issue for this PR
Closes #17211
Type of change
What does this PR do?
The issue
When switching servers, the provider tree is not properly rebuilt.
GlobalSDKProviderandGlobalSyncProvidercaptureserver.currentat mount time and build SDK clients, SSE streams, event queues, and child stores around that snapshot. Without a remount boundary, switching servers left the entire subtree pointing at the old server — stale SDK clients, stale SSE connections, stale project data, and stale directory routes causing problems with displaying recent projects and properly spawning terminals.Fix
This PR wraps the server-bound subtree in a Remount component keyed on server.key. This uses
<For each={[key]}>. I tried making use of<Show when{server.key} keyed>(was also used previously before this commit b76ead3#diff-dc4486239f5091faca2b1d9b42efc48d0e5323b5388e53403f37f446a1d63fc8) but it still would not allow for proper remounting of the needed components, so I had situations like the sidebar still showing stale projects and it triggersTypeError: null is not an object (evaluating 'node.owned[i]')error.This is a small fix I could get working, I believe the best solution for the future would be to make
GlobalSDKProviderandGlobalSyncProviderinternally reactive to server changes rather than relying on a full subtree remount. Since that will be a large rewrite I decided to make a simpler PR that works even if not as effective.How did you verify your code works?
Tested on my local machine switching around 2 remote servers while having my terminal open with everything working as it should. Check video below.
Screenshots / recordings
Screen.Recording.2026-03-12.at.17.59.42.mov
Checklist