-
-
Notifications
You must be signed in to change notification settings - Fork 56
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
[solidjs] How to use createResource or createAsync to load default values #230
Comments
I think in this case the best thing to do is to use |
Brilliant. It works. Its a bit counterintuitive to use reset to load data, but nothing a good comment could make it future proof. Thanks Fabian! |
I know. 😐 It makes sense to "reset" the form with new initial values, but I understand that it feels wrong in the first place. Would you choose a different name or just improve the documentation? |
In my mind, resetting just restore a previous state of the form. Data loading should define the initial state, until the next submit, which create a new state to rollback. I've not digged through the code of your brilliant library, so I'm completely ignorant of the process behind: is it difficult to make the |
Thank you for your feedback and recommendation. I will think about it! I agree that it can improve the DX a lot in these cases. |
Hey Fabian! I've tried to JSON.stringify the field property returned by the Field component: while this is what it pass when using setValues |
I know, and I am sorry. This is a known bug. There should already be an open issue. I hope to find some time one day to fix such problems. |
It probably will feel "more Solid" if the form options can be made reactive like createForm(()=>options). |
Hi all!
as the title says, is it possible to "watch" createResource/createAsync to load initial values of the form in an async way?
Relying on createEffect to set them using setValues surely works, but for example, in a solid start application interferes with the form submission, firing before the actual form is submitted.
Thanks in advance!
The text was updated successfully, but these errors were encountered: