From 30a4a40d50fc9d5328532437b3d34f9790c7dd41 Mon Sep 17 00:00:00 2001 From: Tim deBoer Date: Mon, 18 Nov 2024 10:36:59 -0500 Subject: [PATCH] fix: use option property to ensure options is treated as state See #9917 for background. Svelte reuses component instances whenever possible. The problem here is that the Dropdown options are being set via child option elements, created via buildOptions. When you switch pages all of the explicitly set properties and state are applied, but since options is not set as a property, nor state, it is not applied. The simplest fix in this case is using the options parameter directly, which we do in other cases and causes Svelte to correctly treat it as state. This is only avoiding the problem though, so I've opened #9952 for future follow up. I've checked and we have no other child options where this would currently happen, but the real fix is possibly a Svelte fix, removing child option support, or finding a fix directly in Dropdown. Fixes #9917. Signed-off-by: Tim deBoer --- .../src/lib/preferences/item-formats/EnumItem.svelte | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/renderer/src/lib/preferences/item-formats/EnumItem.svelte b/packages/renderer/src/lib/preferences/item-formats/EnumItem.svelte index 1066c8aff..e149ea086 100644 --- a/packages/renderer/src/lib/preferences/item-formats/EnumItem.svelte +++ b/packages/renderer/src/lib/preferences/item-formats/EnumItem.svelte @@ -23,10 +23,6 @@ function onChangeHandler(newValue: unknown) { onChange={onChangeHandler} bind:value={value} ariaInvalid={invalidEntry} - ariaLabel={record.description}> - {#if record.enum} - {#each record.enum as recordEnum} - - {/each} - {/if} + ariaLabel={record.description} + options={record.enum?.map(recordEnum => ({label: recordEnum, value: recordEnum}))}>