You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I have some slow data that needs to be fetched from a database, which pre-populates the form. I don't want the user to wait 4 seconds for the page to load, since the form itself is not the main feature of the page, so I use an {#await} block to show a spinner while the data is dynamically streamed, like in this documentation: https://svelte.dev/docs/kit/load#Streaming-with-promises
From what I've dug around, zod does support promises but no matter how much I fiddled with it, superforms does not want to accept a promise on the server for superValidate
Describe the solution you'd like
To accept a z.promise and integrate with an await block somehow.
Describe alternatives you've considered
I tried to return the Promise result from superValidate on the server, and then await that on the client, but the resulting code was quite disgusting and didn't really work at all, especially trying to use enhance
The text was updated successfully, but these errors were encountered:
I'd have to have a lot more knowledge about the codebase to even begin forming a relevant opinion, but a 'back of the napkin' thought would be to chain the promise with another then() that would do what superforms needs for its magic to work.
The user would just {#await} and the promise will resolve as normal. "Easier said than done" would be an understatement though, as I don't have an idea on how it works behind the scenes, so this may not be the way to go.
Is your feature request related to a problem? Please describe.
I have some slow data that needs to be fetched from a database, which pre-populates the form. I don't want the user to wait 4 seconds for the page to load, since the form itself is not the main feature of the page, so I use an {#await} block to show a spinner while the data is dynamically streamed, like in this documentation: https://svelte.dev/docs/kit/load#Streaming-with-promises
From what I've dug around, zod does support promises but no matter how much I fiddled with it, superforms does not want to accept a promise on the server for superValidate
Describe the solution you'd like
To accept a z.promise and integrate with an await block somehow.
Describe alternatives you've considered
I tried to return the
Promise
result from superValidate on the server, and then await that on the client, but the resulting code was quite disgusting and didn't really work at all, especially trying to use enhanceThe text was updated successfully, but these errors were encountered: