Skip to content

Modern Docker Management, Designed for Everyone

fix: settings state not persisted acorss settings pages

Kyle Mendell46bbe93c862d
diff --git a/frontend/src/routes/settings/docker/+page.svelte b/frontend/src/routes/settings/docker/+page.svelte
index 7fa0ab00d..a30b89931 100644
--- a/frontend/src/routes/settings/docker/+page.svelte
+++ b/frontend/src/routes/settings/docker/+page.svelte
@@ -21,7 +21,7 @@
import { SettingsPageLayout } from '$lib/layouts';
let { data } = $props();
- let currentSettings = $state<Settings>(data.settings!);
+ const currentSettings = $derived<Settings>($settingsStore || data.settings!);
let hasChanges = $state(false);
let isLoading = $state(false);
@@ -140,8 +140,8 @@
async function updateSettingsConfig(updatedSettings: Partial<Settings>) {
try {
await settingsService.updateSettings(updatedSettings as any);
- currentSettings = { ...currentSettings, ...updatedSettings };
- settingsStore.set(currentSettings);
+ const updated = { ...currentSettings, ...updatedSettings };
+ settingsStore.set(updated);
settingsStore.reload();
} catch (error) {
console.error('Error updating settings:', error);
diff --git a/frontend/src/routes/settings/general/+page.svelte b/frontend/src/routes/settings/general/+page.svelte
index 396c86f2b..74cdfcb6a 100644
--- a/frontend/src/routes/settings/general/+page.svelte
+++ b/frontend/src/routes/settings/general/+page.svelte
@@ -24,7 +24,7 @@
let hasChanges = $state(false);
let isLoading = $state(false);
- let currentSettings = $state(data.settings!);
+ const currentSettings = $derived($settingsStore || data.settings!);
const isReadOnly = $derived.by(() => $settingsStore.uiConfigDisabled);
const formState = getContext('settingsFormState') as any;
const formSchema = z.object({
@@ -57,8 +57,8 @@
async function updateSettingsConfig(updatedSettings: Partial<Settings>) {
try {
await settingsService.updateSettings(updatedSettings as any);
- currentSettings = { ...currentSettings, ...updatedSettings };
- settingsStore.set(currentSettings);
+ const updated = { ...currentSettings, ...updatedSettings };
+ settingsStore.set(updated);
settingsStore.reload();
} catch (error) {
console.error('Error updating settings:', error);
@@ -84,12 +84,12 @@
}
function resetForm() {
- $formInputs.projectsDirectory.value = data.settings!.projectsDirectory;
- $formInputs.baseServerUrl.value = data.settings!.baseServerUrl;
- $formInputs.enableGravatar.value = data.settings!.enableGravatar;
- $formInputs.accentColor.value = data.settings!.accentColor;
- $formInputs.glassEffectEnabled.value = data.settings!.glassEffectEnabled;
- applyAccentColor(data.settings!.accentColor);
+ $formInputs.projectsDirectory.value = currentSettings.projectsDirectory;
+ $formInputs.baseServerUrl.value = currentSettings.baseServerUrl;
+ $formInputs.enableGravatar.value = currentSettings.enableGravatar;
+ $formInputs.accentColor.value = currentSettings.accentColor;
+ $formInputs.glassEffectEnabled.value = currentSettings.glassEffectEnabled;
+ applyAccentColor(currentSettings.accentColor);
}
onMount(() => {
diff --git a/frontend/src/routes/settings/navigation/+page.svelte b/frontend/src/routes/settings/navigation/+page.svelte
index b9467cd1f..b0b1ff521 100644
--- a/frontend/src/routes/settings/navigation/+page.svelte
+++ b/frontend/src/routes/settings/navigation/+page.svelte
@@ -19,7 +19,7 @@
import { useSidebar } from '$lib/components/ui/sidebar/context.svelte.js';
let { data } = $props();
- let currentSettings = $state(data.settings!);
+ const currentSettings = $derived($settingsStore || data.settings!);
let hasChanges = $state(false);
let isLoading = $state(false);
@@ -91,8 +91,8 @@
async function updateSettingsConfig(updatedSettings: Partial<Settings>) {
try {
await settingsService.updateSettings(updatedSettings as any);
- currentSettings = { ...currentSettings, ...updatedSettings };
- settingsStore.set(currentSettings);
+ const updated = { ...currentSettings, ...updatedSettings };
+ settingsStore.set(updated);
settingsStore.reload();
} catch (error) {
console.error('Error updating navigation settings:', error);
diff --git a/frontend/src/routes/settings/security/+page.svelte b/frontend/src/routes/settings/security/+page.svelte
index f2433a818..f26214648 100644
--- a/frontend/src/routes/settings/security/+page.svelte
+++ b/frontend/src/routes/settings/security/+page.svelte
@@ -20,7 +20,7 @@
import { SettingsPageLayout } from '$lib/layouts';
let { data }: { data: PageData } = $props();
- let currentSettings = $state<Settings>(data.settings!);
+ const currentSettings = $derived<Settings>($settingsStore || data.settings!);
let hasChanges = $state(false);
let isLoading = $state(false);
@@ -84,8 +84,8 @@
async function updateSettingsConfig(updatedSettings: Partial<Settings>) {
try {
await settingsService.updateSettings(updatedSettings as any);
- currentSettings = { ...currentSettings, ...updatedSettings };
- settingsStore.set(currentSettings);
+ const updated = { ...currentSettings, ...updatedSettings };
+ settingsStore.set(updated);
settingsStore.reload();
} catch (error) {
console.error('Error updating settings:', error);