Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breaking change with empty useForm, 2.0 with svelte #2011

Open
saml-dev opened this issue Oct 11, 2024 · 0 comments · May be fixed by #2052
Open

Breaking change with empty useForm, 2.0 with svelte #2011

saml-dev opened this issue Oct 11, 2024 · 0 comments · May be fixed by #2052
Assignees
Labels
svelte Related to the svelte adapter

Comments

@saml-dev
Copy link

Version:

  • @inertiajs/svelte version: 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)
@saml-dev saml-dev added the svelte Related to the svelte adapter label Oct 11, 2024
@saml-dev saml-dev changed the title I found a breaking change in Svelte with 2.0 Breaking change with empty useForm, 2.0 with svelte Oct 15, 2024
@saml-dev saml-dev linked a pull request Oct 22, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
svelte Related to the svelte adapter
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants