sveltekit-superforms
sveltekit-superforms copied to clipboard
inconsistent behavior between fieldProxy and formFieldProxy with nested data
- [x] Before posting an issue, read the FAQ and search the previous issues.
- [ ] If you're posting a bug for Superforms v2, make sure you're on the latest alpha version with
npm i -D sveltekit-superforms@alpha.
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.
- FieldProxy: creates the parent only if it is undefined
- FormFieldProxy: doesn't create the parent in any case
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
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.
thanks for the quick response and for the awesome library! will try to upgrade.
Reopening, as it needs to be fixed in v1.
Won't be fixed, as v3 is taking shape.