fix(desktop): keep gateway reconnect available on open transports

This commit is contained in:
Teknium
2026-09-07 02:14:55 -07:00
parent c4cbd7a24f
commit 2bd6fe0dde
2 changed files with 18 additions and 17 deletions
@@ -71,7 +71,7 @@ describe('GatewayMenuPanel reconnect action', () => {
afterEach(() => cleanup())
it('shows reconnect only while disconnected and disables it in flight', async () => {
it('shows reconnect while disconnected and disables it in flight', async () => {
let finish: (() => void) | undefined
mocks.reconnectGateway.mockImplementation(
() =>
@@ -92,10 +92,12 @@ describe('GatewayMenuPanel reconnect action', () => {
await act(async () => finish?.())
})
it('hides reconnect while the socket is open', async () => {
it('allows recovery when an open socket stops delivering', async () => {
renderPanel('open')
await act(async () => undefined)
expect(screen.queryByRole('button', { name: 'Reconnect gateway' })).toBeNull()
const reconnect = screen.getByRole('button', { name: 'Reconnect gateway' })
await act(async () => fireEvent.click(reconnect))
expect(mocks.reconnectGateway).toHaveBeenCalledOnce()
})
})
@@ -171,20 +171,19 @@ export function GatewayMenuPanel({
</span>
</div>
<div className="flex shrink-0 items-center gap-0.5">
{!gatewayOpen && (
<Tip label={copy.reconnectGateway}>
<Button
aria-label={copy.reconnectGateway}
className="text-muted-foreground hover:text-foreground"
disabled={reconnecting}
onClick={reconnect}
size="icon-xs"
variant="ghost"
>
<RefreshCw className={cn(reconnecting && 'animate-spin')} />
</Button>
</Tip>
)}
{/* An open transport can still be wedged; recovery must remain reachable. */}
<Tip label={copy.reconnectGateway}>
<Button
aria-label={copy.reconnectGateway}
className="text-muted-foreground hover:text-foreground"
disabled={reconnecting}
onClick={reconnect}
size="icon-xs"
variant="ghost"
>
<RefreshCw className={cn(reconnecting && 'animate-spin')} />
</Button>
</Tip>
<Tip label={copy.openSystem}>
<Button
aria-label={copy.openSystem}