Svelte: Checked-binding malfunctions when input wrapped in a component

Created on 16 Jul 2019  路  2Comments  路  Source: sveltejs/svelte

If I wrap a <input type="checkbox"/> (haven't tested other inputs) in a component, making it a controlled input, it's checked-binding becomes unreliable. It's easy to get that component into a state where the prop that determines the checked state is false, but the input is actually checked.

Best explained with a REPL, which contains instructions on how to reproduce the issue:

https://svelte.dev/repl/c822cdcaa291404289d87b8faabef831?version=3.6.7

Most helpful comment

Maybe its related somehow with the lazy evaluation ... or not. The reorder of the invalidate expression fixes the issue, but dont see why.
https://svelte.dev/repl/c2ac3a1407dd4283a18c36e9c67841cb?version=3.6.7

All 2 comments

Maybe its related somehow with the lazy evaluation ... or not. The reorder of the invalidate expression fixes the issue, but dont see why.
https://svelte.dev/repl/c2ac3a1407dd4283a18c36e9c67841cb?version=3.6.7

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bestguy picture bestguy  路  3Comments

lnryan picture lnryan  路  3Comments

st-schneider picture st-schneider  路  3Comments

Rich-Harris picture Rich-Harris  路  3Comments

matt3224 picture matt3224  路  3Comments