diff --git a/frontend-svelte/src/components/widgets/inputs/FontInput.svelte b/frontend-svelte/src/components/widgets/inputs/FontInput.svelte index 9487020e..42744220 100644 --- a/frontend-svelte/src/components/widgets/inputs/FontInput.svelte +++ b/frontend-svelte/src/components/widgets/inputs/FontInput.svelte @@ -30,21 +30,16 @@ let open = false; let entries: MenuListEntry[] = []; let activeEntry: MenuListEntry | undefined = undefined; - let highlighted: MenuListEntry | undefined = undefined; let minWidth = isStyle ? 0 : 300; - $: fontFamily, - (async () => { - entries = await getEntries(); - activeEntry = getActiveEntry(entries); - highlighted = activeEntry; - })(); - $: fontStyle, - async () => { - entries = await getEntries(); - activeEntry = getActiveEntry(entries); - highlighted = activeEntry; - }; + $: fontFamily, fontStyle, watchFont(); + + async function watchFont(): Promise { + // We set this function's result to a local variable to avoid reading from `entries` which causes Svelte to trigger an update that results in an infinite loop + const newEntries = await getEntries(); + entries = newEntries; + activeEntry = getActiveEntry(newEntries); + } async function setOpen(): Promise { open = true; @@ -106,7 +101,6 @@ entries = await getEntries(); activeEntry = getActiveEntry(entries); - highlighted = activeEntry; }); diff --git a/frontend-svelte/src/components/widgets/inputs/MenuBarInput.svelte b/frontend-svelte/src/components/widgets/inputs/MenuBarInput.svelte index 39b60aab..da5cf7ca 100644 --- a/frontend-svelte/src/components/widgets/inputs/MenuBarInput.svelte +++ b/frontend-svelte/src/components/widgets/inputs/MenuBarInput.svelte @@ -77,6 +77,7 @@