diff --git a/packages/svelte/src/compiler/phases/3-transform/client/visitors/template.js b/packages/svelte/src/compiler/phases/3-transform/client/visitors/template.js index 5f8a30be85..0d6f13aa18 100644 --- a/packages/svelte/src/compiler/phases/3-transform/client/visitors/template.js +++ b/packages/svelte/src/compiler/phases/3-transform/client/visitors/template.js @@ -642,9 +642,12 @@ function serialize_element_special_value_attribute(element, node_id, attribute, ) ); const is_reactive = attribute.metadata.dynamic; - const is_select_with_reactive_value = element === 'select' && is_reactive; + const is_select_with_value = + // attribute.metadata.dynamic would give false negatives because even if the value does not change, + // the inner options could still change, so we need to always treat it as reactive + element === 'select' && attribute.value !== true && !is_text_attribute(attribute); const assignment = b.stmt( - is_select_with_reactive_value + is_select_with_value ? b.sequence([ inner_assignment, // This ensures a one-way street to the DOM in case it's + {#each Object.entries(options) as [key, value] (key)} + + {/each} + + + + +