diff --git a/frontend-modern/src/components/Settings/GuestURLs.tsx b/frontend-modern/src/components/Settings/GuestURLs.tsx index 8c004443c..9288db047 100644 --- a/frontend-modern/src/components/Settings/GuestURLs.tsx +++ b/frontend-modern/src/components/Settings/GuestURLs.tsx @@ -278,12 +278,13 @@ export function GuestURLs(props: GuestURLsProps) { {(guest) => { const guestId = guest.id || `${guest.instance}-${guest.node}-${guest.vmid}`; const fallbackId = `${guest.node}-${guest.vmid}`; - const metadataKey = resolveMetadataKey(guestId, fallbackId); - const meta = guestMetadata()[metadataKey]; - const url = meta?.customUrl; - const hasUrl = Boolean(url && url.trim() !== ''); - const urlError = urlErrors()[metadataKey]; - + + const metadataKey = () => resolveMetadataKey(guestId, fallbackId); + const meta = () => guestMetadata()[metadataKey()]; + const url = () => meta()?.customUrl || ''; + const hasUrl = () => url().trim().length > 0; + const urlError = () => urlErrors()[metadataKey()]; + return ( @@ -308,20 +309,20 @@ export function GuestURLs(props: GuestURLsProps) { updateGuestURL(metadataKey, e.currentTarget.value)} + value={url()} + onInput={(e) => updateGuestURL(metadataKey(), e.currentTarget.value)} class={`w-full min-w-[300px] px-2 py-1 text-sm border rounded bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 focus:ring-2 focus:border-transparent ${ - urlError + urlError() ? 'border-red-500 dark:border-red-400 focus:ring-red-500' : 'border-gray-300 dark:border-gray-600 focus:ring-blue-500' }`} style="min-width: 300px;" /> - +
- {urlError} + {urlError()}
@@ -331,33 +332,33 @@ export function GuestURLs(props: GuestURLsProps) {