Skip to content

Add support for form arrays #401

New issue

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

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

Already on GitHub? # to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

unlocomqx
Copy link

@unlocomqx unlocomqx commented Apr 7, 2024

Fixes #396

Currently, it's not possible to add new forms after component init because life hooks functions are being called when a form is created

This PR moves calls to life hooks outside the superForm function

Test page
http://localhost:5173/v2/multiple-forms

Copy link

vercel bot commented Apr 7, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
superforms ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 11, 2024 9:11pm

When form.id is reassigned during Svelte's derived phase, ERR_SVELTE_UNSAFE_MUTATION is thrown.

It's because it can lead to unexpected errors and possibly cause infinite loops
@ciscoheat
Copy link
Owner

Thank you, do the latest commits fix the message problem, or is it something I have to take a closer look at?

@unlocomqx
Copy link
Author

unlocomqx commented Apr 12, 2024

Yes, the each key fix resolved the messages issue

Thank you

@ciscoheat
Copy link
Owner

Nice work, hopefully I can add this to the next release!

@unlocomqx
Copy link
Author

I'll be glad to see it in any release if it's stable and doesn't cause any trouble :))

@ciscoheat
Copy link
Owner

As mentioned in #396, this has to wait until later.

@ciscoheat ciscoheat added later May be worked on in the future. svelte-5 Related to Svelte 5 labels May 25, 2024
@ciscoheat ciscoheat added this to the v3 milestone Sep 13, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
later May be worked on in the future. svelte-5 Related to Svelte 5
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using superForm with $derived
2 participants