Merge pull request #63040 from NousResearch/bb/desktop-drop-dev-soft-switch

chore(desktop): drop the dev-only "soft switch" preview from gateway settings
This commit is contained in:
brooklyn! 2026-07-12 02:36:25 -05:00 committed by GitHub
commit 79c0806456
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 1 additions and 56 deletions

View file

@ -10,7 +10,6 @@ import { ExternalLink } from '@/lib/external-link'
import { AlertCircle, Check, Cloud, FileText, Globe, HelpCircle, Loader2, LogIn, Monitor, RefreshCw } from '@/lib/icons'
import { selectableCardClass } from '@/lib/selectable-card'
import { cn } from '@/lib/utils'
import { previewGatewaySwitch } from '@/store/gateway-switch'
import { notify, notifyError } from '@/store/notifications'
import { $profiles, refreshActiveProfile } from '@/store/profile'
@ -117,7 +116,6 @@ export function GatewaySettings() {
const [loading, setLoading] = useState(true)
const [saving, setSaving] = useState(false)
const [testing, setTesting] = useState(false)
const [previewingSwitch, setPreviewingSwitch] = useState(false)
const [signingIn, setSigningIn] = useState(false)
const [state, setState] = useState<GatewaySettingsState>(EMPTY_STATE)
const [remoteToken, setRemoteToken] = useState('')
@ -1065,26 +1063,6 @@ export function GatewaySettings() {
description={g.diagnosticsDesc}
title={g.diagnostics}
/>
{import.meta.env.DEV ? (
<ListRow
action={
<Button
disabled={previewingSwitch}
onClick={() => {
setPreviewingSwitch(true)
void previewGatewaySwitch().finally(() => setPreviewingSwitch(false))
}}
size="sm"
variant="textStrong"
>
{previewingSwitch ? <Loader2 className="animate-spin" /> : null}
Preview soft switch
</Button>
}
description="Wipe session lists so sidebar skeletons retrigger — no real backend teardown."
title="Dev · soft switch"
/>
) : null}
</div>
</SettingsContent>
)

View file

@ -16,7 +16,7 @@ import {
setSessionsTotal
} from '@/store/session'
import { $gatewaySwitching, previewGatewaySwitch, wipeSessionListsForGatewaySwitch } from './gateway-switch'
import { $gatewaySwitching, wipeSessionListsForGatewaySwitch } from './gateway-switch'
vi.mock('@/lib/query-client', () => ({
queryClient: { invalidateQueries: vi.fn() }
@ -54,12 +54,4 @@ describe('wipeSessionListsForGatewaySwitch', () => {
expect($sessionsLimit.get()).toBe(SIDEBAR_SESSIONS_PAGE_SIZE)
expect($freshDraftReady.get()).toBe(true)
})
it('previewGatewaySwitch holds skeletons then clears loading', async () => {
await previewGatewaySwitch(20)
expect($sessions.get()).toEqual([])
expect($sessionsLoading.get()).toBe(false)
expect($gatewaySwitching.get()).toBe(false)
})
})

View file

@ -24,8 +24,6 @@ import {
// overlay from resurrecting when startHermes re-emits boot progress.
export const $gatewaySwitching = atom(false)
const PREVIEW_HOLD_MS = 1400
/**
* Clear gateway-bound session UI so sidebar skeletons retrigger.
*
@ -58,26 +56,3 @@ export function wipeSessionListsForGatewaySwitch(): void {
void queryClient.invalidateQueries()
}
/**
* Dev review beat: wipe skeletons for PREVIEW_HOLD_MS clear loading.
* Does not tear down a real backend. Fired from the Settings button (Electron
* has no easy `?query=` entry).
*/
export async function previewGatewaySwitch(holdMs = PREVIEW_HOLD_MS): Promise<void> {
if ($gatewaySwitching.get()) {
return
}
$gatewaySwitching.set(true)
wipeSessionListsForGatewaySwitch()
try {
await new Promise<void>(resolve => {
window.setTimeout(resolve, holdMs)
})
} finally {
setSessionsLoading(false)
$gatewaySwitching.set(false)
}
}