Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Studio: stop the providers dialog from resetting custom provider form state (#6051)

Nilay436525d6de1d
diff --git a/studio/frontend/src/features/chat/chat-providers-dialog.tsx b/studio/frontend/src/features/chat/chat-providers-dialog.tsx
index 42f8e56ac54..e35a8e35e01 100644
--- a/studio/frontend/src/features/chat/chat-providers-dialog.tsx
+++ b/studio/frontend/src/features/chat/chat-providers-dialog.tsx
@@ -212,6 +212,7 @@ export function ChatProvidersSettings({
onProvidersChange,
}: ChatProvidersSettingsProps) {
const providersRef = useRef(providers);
+ const seededProviderTypeRef = useRef<string | null>(null);
const [page, setPage] = useState<"list" | "form">("list");
const [providerType, setProviderType] = useState<string>("");
const [apiKey, setApiKey] = useState("");
@@ -317,6 +318,8 @@ export function ChatProvidersSettings({
useEffect(() => {
if (!providerType || editingProviderId) return;
+ if (seededProviderTypeRef.current === providerType) return;
+ seededProviderTypeRef.current = providerType;
const entry = registryByType.get(providerType);
if (!entry) {
if (isCustomProviderType(providerType)) {
@@ -363,7 +366,8 @@ export function ChatProvidersSettings({
setProviderType((current) => {
if (
current &&
- registryRows.some((entry) => entry.provider_type === current)
+ (isCustomProviderType(current) ||
+ registryRows.some((entry) => entry.provider_type === current))
) {
return current;
}