fix(desktop): remote server switching#17214
Conversation
…h to properly reset SDK and SSE state
…to explain its use
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
Head branch was pushed to by a user without write access
|
@Brendonovich I just tried to merge with dev, this issue still happens when using the Screen.Recording.2026-03-15.at.11.21.10.movIn the video the whole page doesnt reload to switch to a new server. That was the reason I opted to use the |
|
I have singled out the issue to be related to running PTY instances, when you have none running, server switches happen as it should, but once you open one it breaks, so trying to get some fixes for that, went with adding server scoped terminal caches, even if its a good addition it doesnt solve the issue, so I made it into another PR, while I work on this one to solve the main issue. |
…Y callbacks to their workspace
|
Made a new commit that fixes the issue, makes switching of servers even with the terminal open simple.
Result Screen.Recording.2026-03-15.at.14.26.21.movThis PR goes well with this one allowing for proper revival of pty with stale ID |
Co-authored-by: Brendan Allan <[email protected]>
Co-authored-by: Brendan Allan <[email protected]>
Co-authored-by: Brendan Allan <[email protected]>
Co-authored-by: Brendan Allan <[email protected]>
Co-authored-by: Brendan Allan <[email protected]> (cherry picked from commit bd4527b)
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