svelte-schema-form icon indicating copy to clipboard operation
svelte-schema-form copied to clipboard

`value` property gets mutated when it's not binded

Open DetachHead opened this issue 2 years ago • 0 comments

<!-- +page.svelte -->
<script>
    let value = {}
</script>
<SchemaForm
    {schema}
    {value}
    on:value={(e) => {
          console.log('new value', e.detail.value) // prints the new value
          console.log('original value', value) // prints the new value, should print the old value
    }}
/>

i may be wroing because i still don't fully understand how you're supposed to handle state in svelte, but the way i understand it, the value property in +page.svelte should not change unless it is either explicitly updated within my code or binded with bind:value

DetachHead avatar Apr 05 '23 02:04 DetachHead