You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However after hydration, the browser shows the element like this:
<inputid="lang_nl" type="radio" name="lang">
Removing the condition statement checked={lang === "nl"} or setting it to a "boolean" value i.e. checked fixes the issue
Reproduction
Note: in SPA mode this doesn't actually reproduce the issue. You need to run this locally and perform a hard refresh on the page to reproduce the behaviour, as the issue may have something to do with hydration? Repl link
Logs
No response
System Info
Svelte 5.0.0-next.123
Severity
annoyance
The text was updated successfully, but these errors were encountered:
I feel this is expected, https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox, checked can be property/state, on server side to set it as a default property, this is added as a attribute but without any value, but on client this is state/property of the input, to set it as attribute this you can use setAttribute, so I think Svelte only set the property.
But you are right, attribute cum property having a static value and should be shown in the initial template
I think I have not been clear enough in my issue description. The entire value="nl" attribute disappears, breaking the input. The server renders this attribute and in SPA mode (e.g. the repl link) the issue also does not occur.
Only when you refresh the page and svelte hydrates the server rendered html, the value="nl" attribute is gone, breaking the input.
Describe the bug
I have a simple set of radio buttons to switch language. I want to have the current option checked by using a simple conditional.
When the page is rendered server-side, it looks like this:
However after hydration, the browser shows the element like this:
Removing the condition statement
checked={lang === "nl"}
or setting it to a "boolean" value i.e.checked
fixes the issueReproduction
Note: in SPA mode this doesn't actually reproduce the issue. You need to run this locally and perform a hard refresh on the page to reproduce the behaviour, as the issue may have something to do with hydration?
Repl link
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: