fix(desktop): show the launch-source preference for a single connection

The toggle was gated on having 2+ registered sources, which hid it in exactly
the local-only state the drift produces — the state where a user most needs to
change what launch restores.
This commit is contained in:
Brooklyn Nicholson
2026-08-23 20:06:49 -05:00
committed by brooklyn!
parent d5463b3f46
commit c25f206ecf
2 changed files with 10 additions and 3 deletions

View File

@@ -161,13 +161,16 @@ describe('ConnectionsRegistrySection', () => {
await waitFor(() => expect(setLaunchMode).toHaveBeenCalledWith('last-used'))
})
it('keeps the launch preference out of the way for a single source', async () => {
it('offers the launch preference even for a single source', async () => {
// A local-only registry is the drift state from #90174, and the launch
// toggle is the control that lets a user out of it. Hiding it there left
// hand-editing connections.json as the only recourse.
list.mockResolvedValueOnce({ ...registry, connections: [registry.connections[0]] })
render(<ConnectionsRegistrySection />)
await waitFor(() => expect(list).toHaveBeenCalledTimes(1))
expect(screen.queryByText('At startup, return to Sessions on the last-used gateway')).toBeNull()
expect(screen.getByText('At startup, return to Sessions on the last-used gateway')).toBeTruthy()
})
it('keeps search out of the way for a small registry', async () => {

View File

@@ -989,7 +989,11 @@ export function ConnectionsRegistrySection() {
</div>
)}
{!loading && registry && registry.connections.length > 1 && (
{/* Not gated on connections.length > 1: a registry that drifted down to
local-only is exactly the state where a user needs to see and change
the launch behavior, and hiding the control there left hand-editing
connections.json as the only recourse (#90174). */}
{!loading && registry && (
<div className="mt-6 border-t border-border/60 pt-4">
<ToggleRow
checked={registry.launchMode === 'last-used'}