ciscoheat / sveltekit-superforms

Making SvelteKit forms a pleasure to use!
https://superforms.rocks
MIT License
2.13k stars 63 forks source link

inconsistent behavior between fieldProxy and formFieldProxy with nested data #322

Closed Alessandro-Mezzogori closed 1 month ago

Alessandro-Mezzogori commented 7 months ago

Description proxying an inner field of an undefined ( or null ) parent object behaves differently with FormFieldProxy and FieldProxy in regards of creating the parent if it doesn't exist.

this leads to values of the forms being displayed in the input element but not being set in the backing json object.

If applicable, a MRE MRE: https://stackblitz.com/~/edit/sveltekit-superforms-1-testing-nxq1t8?file=src%2Froutes%2F%2Bpage.server.ts,src%2Froutes%2F%2Bpage.svelte

ciscoheat commented 7 months ago

This is fixed in v2, where the parent will always be created if undefined. If you can upgrade it will work, otherwise, you'll have to wait for the next release, which may be a while since I'm focusing on releasing v2 right now.

Alessandro-Mezzogori commented 7 months ago

thanks for the quick response and for the awesome library! will try to upgrade.

ciscoheat commented 7 months ago

Reopening, as it needs to be fixed in v1.

ciscoheat commented 1 month ago

Won't be fixed, as v3 is taking shape.