Open dimfeld opened 2 years ago
REPL https://svelte.dev/repl/8cf99db4663c4071a939497570b9b21d?version=3.2.2 not working when javascript is disabled
Still occurring in latest
Looks like this bug is still present in 4.2.2
When SSR is enabled. The option that should be selected during SSR generation is not selected
Here's a repro of what I think is the same issue in SvelteKit. Before selecting the bar
value which is selected by default, the foo
value is shown initially:
https://www.sveltelab.dev/935c64eqjh3sf3i
Might be a bigger topic. Any thing new here?
Describe the bug
When using code like the following, the SSR output does not generate the
selected
attribute on the<option>
corresponding to the value. This means that the initial displayed value is incorrect until hydration takes place.The behavior is similar when just using
value
instead ofbind:value
. In that case SSR generates avalue
attribute on theselect
, but the browser doesn't honor it.I've worked around this in my own project by writing this:
Reproduction
See the JS output of https://svelte.dev/repl/39c922f259564703ba7b8adc83c256f1?version=3.46.2 with
generate
set tossr
.Reproduced here for reference.
Logs
No response
System Info
Severity
annoyance