webui: fix custom headers persistence in UI

This commit is contained in:
Pascal 2026-01-15 20:09:59 +01:00
parent cffc3b46ae
commit 3360f60b94
2 changed files with 8 additions and 3 deletions

View File

@ -1,5 +1,5 @@
<script lang="ts">
import { onMount } from 'svelte';
import { onMount, tick } from 'svelte';
import * as Card from '$lib/components/ui/card';
import type { MCPServerSettingsEntry, HealthCheckState } from '$lib/types';
import { HealthCheckStatus } from '$lib/enums';
@ -74,9 +74,10 @@
mcpClient.runHealthCheck(server);
}
function startEditing() {
editFormRef?.setInitialValues(server.url, server.headers || '');
async function startEditing() {
isEditing = true;
await tick();
editFormRef?.setInitialValues(server.url, server.headers || '');
}
function cancelEditing() {

View File

@ -25,6 +25,10 @@
// Local state for header pairs
let headerPairs = $state<KeyValuePair[]>(parseHeadersToArray(headers));
$effect(() => {
headerPairs = parseHeadersToArray(headers);
});
// Sync header pairs to parent when they change
function updateHeaderPairs(newPairs: KeyValuePair[]) {
headerPairs = newPairs;