inertia
inertia copied to clipboard
Breaking change with empty useForm, 2.0 with svelte
Version:
@inertiajs/svelteversion: 2.0.0-beta.1
Describe the problem:
I use the useForm helper in my Svelte app for forms that have no data. With Inertia 1.0.16, I could just use useForm(), passing nothing. In 2.0, it throws unless you pass an empty object like useForm({}). That's no biggie obviously, it just may be worth mentioning in the upgrade docs as a breaking change if it stays this way for release :)
Now that I think about it, this might apply to React and Vue too. I haven't tested them.
Steps to reproduce:
Just use useForm() anywhere in a svelte app and you'll see this error:
@inertiajs_svelte.js?v=74ba9348:8751 Uncaught (in promise) TypeError: Cannot convert undefined or null to object
at Function.keys (<anonymous>)
at Object.data (@inertiajs_svelte.js?v=74ba9348:8751:21)
at @inertiajs_svelte.js?v=74ba9348:8883:59
at Object.subscribe2 [as subscribe] (chunk-GRQJ6R46.js?v=be2c4f16:46:5)
at useForm (@inertiajs_svelte.js?v=74ba9348:8882:10)
at instance (BucketCard.svelte:25:25)
at init (chunk-SGFLL5OL.js?v=be2c4f16:2190:23)
at new BucketCard (BucketCard.svelte:22:43)
at createProxiedComponent (svelte-hooks.js?v=be2c4f16:341:9)
at new ProxyComponent (proxy.js?v=be2c4f16:242:7)