From a5183eb5b599305f74ad2481109597f9c978c23b Mon Sep 17 00:00:00 2001 From: OpeOginni Date: Thu, 12 Mar 2026 13:03:32 +0100 Subject: [PATCH 1/4] fix(desktop): remount sdk and sync contexts when switching servers --- packages/app/src/app.tsx | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/packages/app/src/app.tsx b/packages/app/src/app.tsx index 1b7ffde46a1..33000222eff 100644 --- a/packages/app/src/app.tsx +++ b/packages/app/src/app.tsx @@ -129,6 +129,15 @@ function RouterRoot(props: ParentProps<{ appChildren?: JSX.Element }>) { ) } +function ServerScope(props: ParentProps) { + const server = useServer() + return ( + + {props.children} + + ) +} + export function AppBaseProviders(props: ParentProps) { return ( @@ -265,20 +274,22 @@ export function AppInterface(props: { return ( - - - {routerProps.children}} - > - - - - - - - - + + + + {routerProps.children}} + > + + + + + + + + + ) From e9ee9bef41373e481bb81703e460152049f9d0b4 Mon Sep 17 00:00:00 2001 From: OpeOginni Date: Thu, 12 Mar 2026 18:01:37 +0100 Subject: [PATCH 2/4] fix(desktop): use keyed remount with Component for server switch to properly reset SDK and SSE state --- packages/app/src/app.tsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/app/src/app.tsx b/packages/app/src/app.tsx index 33000222eff..0765347ca8c 100644 --- a/packages/app/src/app.tsx +++ b/packages/app/src/app.tsx @@ -131,11 +131,7 @@ function RouterRoot(props: ParentProps<{ appChildren?: JSX.Element }>) { function ServerScope(props: ParentProps) { const server = useServer() - return ( - - {props.children} - - ) + return {() => props.children} } export function AppBaseProviders(props: ParentProps) { From 392f3abd5b4b9b9d17bdb8594122da1ac45ba385 Mon Sep 17 00:00:00 2001 From: OpeOginni Date: Thu, 12 Mar 2026 18:04:07 +0100 Subject: [PATCH 3/4] refactor(desktop): replace ServerScope with Remount for and comments to explain its use --- packages/app/src/app.tsx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/app/src/app.tsx b/packages/app/src/app.tsx index 0765347ca8c..3e4220d5877 100644 --- a/packages/app/src/app.tsx +++ b/packages/app/src/app.tsx @@ -129,9 +129,14 @@ function RouterRoot(props: ParentProps<{ appChildren?: JSX.Element }>) { ) } -function ServerScope(props: ParentProps) { - const server = useServer() - return {() => props.children} +// Destroys and recreates its children when `on` changes. +// does not reliably tear down complex owner trees +// (routers + nested providers) and causes: +// TypeError: null is not an object (evaluating 'node.owned[i]') +// over a single-item array is the standard Solid workaround: +// the old item is removed and the new item added, fully disposing the old scope. +function Remount(props: ParentProps<{ on: string }>) { + return {() => props.children} } export function AppBaseProviders(props: ParentProps) { @@ -270,7 +275,7 @@ export function AppInterface(props: { return ( - + - + ) From 9c2cb0fad4ab1f5e4d4d48baa3eba701160d41c6 Mon Sep 17 00:00:00 2001 From: Brendan Allan Date: Fri, 13 Mar 2026 08:59:32 +0800 Subject: [PATCH 4/4] use ServerKey instead --- packages/app/src/app.tsx | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/packages/app/src/app.tsx b/packages/app/src/app.tsx index 3e4220d5877..3d404368d4e 100644 --- a/packages/app/src/app.tsx +++ b/packages/app/src/app.tsx @@ -129,16 +129,6 @@ function RouterRoot(props: ParentProps<{ appChildren?: JSX.Element }>) { ) } -// Destroys and recreates its children when `on` changes. -// does not reliably tear down complex owner trees -// (routers + nested providers) and causes: -// TypeError: null is not an object (evaluating 'node.owned[i]') -// over a single-item array is the standard Solid workaround: -// the old item is removed and the new item added, fully disposing the old scope. -function Remount(props: ParentProps<{ on: string }>) { - return {() => props.children} -} - export function AppBaseProviders(props: ParentProps) { return ( @@ -266,6 +256,15 @@ function ConnectionError(props: { onRetry?: () => void; onServerSelected?: (key: ) } +function ServerKey(props: ParentProps) { + const server = useServer() + return ( + + {props.children} + + ) +} + export function AppInterface(props: { children?: JSX.Element defaultServer: ServerConnection.Key @@ -275,7 +274,7 @@ export function AppInterface(props: { return ( - + - + )