webui: fix custom headers persistence in UI
This commit is contained in:
parent
162bd976ed
commit
f42e5f114e
|
|
@ -1,5 +1,5 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onMount } from 'svelte';
|
import { onMount, tick } from 'svelte';
|
||||||
import * as Card from '$lib/components/ui/card';
|
import * as Card from '$lib/components/ui/card';
|
||||||
import type { MCPServerSettingsEntry, HealthCheckState } from '$lib/types';
|
import type { MCPServerSettingsEntry, HealthCheckState } from '$lib/types';
|
||||||
import { HealthCheckStatus } from '$lib/enums';
|
import { HealthCheckStatus } from '$lib/enums';
|
||||||
|
|
@ -74,9 +74,10 @@
|
||||||
mcpClient.runHealthCheck(server);
|
mcpClient.runHealthCheck(server);
|
||||||
}
|
}
|
||||||
|
|
||||||
function startEditing() {
|
async function startEditing() {
|
||||||
editFormRef?.setInitialValues(server.url, server.headers || '');
|
|
||||||
isEditing = true;
|
isEditing = true;
|
||||||
|
await tick();
|
||||||
|
editFormRef?.setInitialValues(server.url, server.headers || '');
|
||||||
}
|
}
|
||||||
|
|
||||||
function cancelEditing() {
|
function cancelEditing() {
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,10 @@
|
||||||
// Local state for header pairs
|
// Local state for header pairs
|
||||||
let headerPairs = $state<KeyValuePair[]>(parseHeadersToArray(headers));
|
let headerPairs = $state<KeyValuePair[]>(parseHeadersToArray(headers));
|
||||||
|
|
||||||
|
$effect(() => {
|
||||||
|
headerPairs = parseHeadersToArray(headers);
|
||||||
|
});
|
||||||
|
|
||||||
// Sync header pairs to parent when they change
|
// Sync header pairs to parent when they change
|
||||||
function updateHeaderPairs(newPairs: KeyValuePair[]) {
|
function updateHeaderPairs(newPairs: KeyValuePair[]) {
|
||||||
headerPairs = newPairs;
|
headerPairs = newPairs;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue