ui : stop settings save from clobbering backend config

Assisted-by: pi:llama.cpp/DeepSeek-V4.1-Flash
This commit is contained in:
Aleksander Grygier
2026-09-28 12:10:10 +02:00
parent dfcf80f7b3
commit 65a3ed656b
@@ -48,6 +48,11 @@
let localConfig: SettingsConfigType = $state({ ...settingsStore.config });
// Snapshot used to persist only the fields edited in this dialog. Config keys
// that other surfaces write directly (backends, MCP servers) must not be
// clobbered by the dialog's save.
let baseline: SettingsConfigType = $state({ ...settingsStore.config });
let mobileHeader: { updateCarousel: () => void } | undefined;
let fetchInitiated = false;
@@ -75,6 +80,7 @@
function handleReset() {
localConfig = { ...settingsStore.config };
baseline = { ...settingsStore.config };
setMode(localConfig.theme as ColorMode);
mobileHeader?.updateCarousel();
}
@@ -95,7 +101,13 @@
}
}
const processedConfig = { ...localConfig };
const processedConfig: SettingsConfigType = {};
for (const [key, value] of Object.entries(localConfig)) {
if (value !== baseline[key]) {
processedConfig[key] = value;
}
}
for (const field of NUMERIC_FIELDS) {
if (processedConfig[field] !== undefined && processedConfig[field] !== '') {
@@ -127,6 +139,7 @@
export function reset() {
localConfig = { ...settingsStore.config };
baseline = { ...settingsStore.config };
}
</script>