fix(remote): simplify connection mutations and preserve host state

This commit is contained in:
Xubin Ren committed 2026-10-02 11:36:34 +08:00
1 parent 0ffdf86619
commit 2330bfc5a5
7 files changed
+96 -37

No files matched your search

@@ -30,6 +30,7 @@ const RemoteContext = createContext<{
rename: (id: string, name: string) => Promise<void>;
connect: (id: string, stillWanted?: () => boolean) => Promise<void>;
disconnect: (id: string) => Promise<void>;
remove: (id: string) => Promise<void>;
cancel: () => void;
} | null>(null);
export function useRemoteConnections() { return useContext(RemoteContext); }
@@ -161,7 +162,7 @@ export function RemoteInstances({ children }: { children: ReactNode }) {
embeddedManagement: !!bridge.embedded, reportManagementSurface: bridge.embedded ? bridge.reportSurface : undefined,
closeManagement: bridge.embedded ? bridge.leaveManagement : () => changeManagement(false), selectLocal,
openHostIds: frames.map((frame) => frame.connection.id),
directoryError: hosts.directoryError, refresh: hosts.refresh, rename: hosts.rename, connect, disconnect: hosts.disconnect, cancel: hosts.cancel }}>
directoryError: hosts.directoryError, refresh: hosts.refresh, rename: hosts.rename, connect, disconnect: hosts.disconnect, remove: hosts.remove, cancel: hosts.cancel }}>
<HostNavigationContext.Provider value={bridge.embedded || (available || selected ? picker : null)}>
<div className="flex h-full min-h-0 flex-col bg-background">
<div className="relative min-h-0 flex-1 overflow-hidden">