diff --git a/gui/src/pages/Providers.tsx b/gui/src/pages/Providers.tsx index 736200b3f..287d419ec 100644 --- a/gui/src/pages/Providers.tsx +++ b/gui/src/pages/Providers.tsx @@ -10,7 +10,6 @@ import { useT } from "../i18n/shared"; import { formatProviderDisplayName } from "../provider-icons"; import { useProviderAccountPools } from "../hooks/useProviderAccountPools"; import { useCodexAccountPool } from "../hooks/useCodexAccountPool"; -import { useJsonConfigEditor } from "../hooks/useJsonConfigEditor"; import { useKeyedClientResource } from "../client-resource"; import { readSessionListCache } from "../session-list-cache"; import type { ProvidersConfig } from "./providers-shared"; @@ -143,18 +142,6 @@ export default function Providers({ apiBase }: { apiBase: string }) { switchAccount, switchApiKey, removeApiKey, addApiKeyValue, editCredentialAlias, removeAccount, activeAccountNeedsReauth, } = pools; - const jsonEditor = useJsonConfigEditor({ - apiBase, config, - notify, - fetchConfig, fetchProviderQuotas, onSaved: () => setModelsRefreshToken(n => n + 1), - t: t as unknown as Parameters[0]["t"], - }); - const { - draft, setDraft, jsonEditorOpen, jsonSaving, jsonLeaveOpen, - saveConfig, openJsonEditor, discardJsonEditor, requestCloseJsonEditor, restoreJsonEditor, - jsonIsDirty, setJsonLeaveOpen, - } = jsonEditor; - useEffect(() => { // Deferred by a microtask, not a timer. A timer had to be cancelled in cleanup, so navigating // away within the same tick dropped both requests with nothing to retry them and the page came @@ -274,17 +261,6 @@ export default function Providers({ apiBase }: { apiBase: string }) { selectedName={workspaceSelected} onSelect={setWorkspaceSelected} onAddProvider={intent => { setAddIntent(intent ?? null); setAdding(true); }} - onEditConfig={openJsonEditor} - jsonEditor={{ - open: jsonEditorOpen, - draft, - isDirty: jsonIsDirty, - onDraftChange: setDraft, - onSave: () => saveConfig(), - onClose: requestCloseJsonEditor, - onRestore: restoreJsonEditor, - }} - jsonSaving={jsonSaving} modelsRefreshToken={modelsRefreshToken} activeAccountNeedsReauth={activeAccountNeedsReauth} quotaRefreshEpoch={quotaRefresh.epoch} @@ -350,8 +326,6 @@ export default function Providers({ apiBase }: { apiBase: string }) { ? Object.entries(config.providers).find(([name, provider]) => name !== removeConfirmName && provider.disabled !== true)?.[0] ?? null : null} codexLoginOpen={codexLoginOpen} - jsonLeaveOpen={jsonLeaveOpen} - jsonSaving={jsonSaving} oauthTosPending={oauthTosPending} onCloseAdd={() => { if (busy) void cancelLoginOAuth(busy); @@ -382,9 +356,6 @@ export default function Providers({ apiBase }: { apiBase: string }) { }} onCancelRemove={() => setRemoveConfirmName(null)} onConfirmRemove={() => { void confirmRemoveProvider(removeConfirmName); }} - onCancelJsonLeave={() => { if (!jsonSaving) setJsonLeaveOpen(false); }} - onDiscardJson={discardJsonEditor} - onSaveJson={() => { void saveConfig(); }} onCancelOauthTos={() => setOauthTosPending(null)} onContinueOauthTos={() => { const pending = oauthTosPending; diff --git a/gui/tests/providers-json-editor-disabled.test.ts b/gui/tests/providers-json-editor-disabled.test.ts new file mode 100644 index 000000000..cf807880d --- /dev/null +++ b/gui/tests/providers-json-editor-disabled.test.ts @@ -0,0 +1,9 @@ +import { expect, test } from "bun:test"; + +test("Providers does not expose the disabled full-config save flow", async () => { + const source = await Bun.file(new URL("../src/pages/Providers.tsx", import.meta.url)).text(); + + expect(source).not.toContain("useJsonConfigEditor"); + expect(source).not.toContain("onEditConfig="); + expect(source).not.toContain("jsonEditor="); +});