Revert "Sync provider settings with settings.yml in config UI" (#5271)

Reverts Stirling-Tools/Stirling-PDF#5270
This commit is contained in:
Anthony Stirling 2025-12-20 22:21:45 +00:00 committed by GitHub
parent 5eafbf9e51
commit a5dcdd5bd9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 12 deletions

View File

@ -1,4 +1,4 @@
import { useEffect, useState } from 'react';
import { useState } from 'react';
import { Paper, Group, Text, Button, Collapse, Stack, TextInput, Textarea, Switch, PasswordInput } from '@mantine/core';
import { useTranslation } from 'react-i18next';
import LocalIcon from '@app/components/shared/LocalIcon';
@ -25,22 +25,14 @@ export default function ProviderCard({
const [expanded, setExpanded] = useState(false);
const [localSettings, setLocalSettings] = useState<Record<string, any>>(settings);
// Keep local settings in sync with incoming settings (values loaded from settings.yml)
useEffect(() => {
if (!expanded) {
setLocalSettings(settings);
}
}, [settings, expanded]);
// Initialize local settings with defaults when opening an unconfigured provider
const handleConnectToggle = () => {
if (!isConfigured && !expanded) {
// First time opening an unconfigured provider - initialize with defaults
// while preserving any values already present (from settings.yml)
const defaultSettings: Record<string, any> = { ...settings };
const defaultSettings: Record<string, any> = {};
provider.fields.forEach((field) => {
if (field.defaultValue !== undefined) {
defaultSettings[field.key] = defaultSettings[field.key] ?? field.defaultValue;
defaultSettings[field.key] = field.defaultValue;
}
});
setLocalSettings(defaultSettings);

View File

@ -422,7 +422,6 @@ export default function AdminConnectionsSection() {
key={provider.id}
provider={provider}
isConfigured={false}
settings={getProviderSettings(provider)}
onSave={(providerSettings) => handleProviderSave(provider, providerSettings)}
disabled={!loginEnabled}
/>