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'm using Decimal.js in zod schemas. When I use the superForm with dataType='json', posting data fails during devalue.stringify, because it cannot serialize custom type "Decimal".
Describe the solution you'd like
Feature request: provide possibility to pass reducers/revivers to superForm/superValidate to parse the request data accordingly.
Describe alternatives you've considered
asynconSubmit(input){// Reduce custom types before submittingconstformData=awaitsuperFormResult.validateForm();if(formData.valid){constformJsonData=JSON.parse(JSON.stringify(formData.data));input.jsonData(formJsonData);}},
I also tried to fork and npm-link the devalue package for sveltekit (to provide default reducers/revivers for sveltekit), but superforms is using 4.3.3 and sveltekit 5.0.0 (which may still be different in the future). Even if I "override" the dependency to use 5.0.0, this one instantiated in a different (memory) context and default reducers/revivers working for sveltekit are empty for superforms - so "no go".
Additional context
None
The text was updated successfully, but these errors were encountered:
and providing it to SuperForms, a lot of stuff ends up working. But it breaks when you return data from a load function to the form, in the end at least as far as I can see, this needs to happen at a svelte kit level.
Is your feature request related to a problem? Please describe.
I'm using Decimal.js in zod schemas. When I use the superForm with dataType='json', posting data fails during devalue.stringify, because it cannot serialize custom type "Decimal".
Describe the solution you'd like
Feature request: provide possibility to pass reducers/revivers to superForm/superValidate to parse the request data accordingly.
Describe alternatives you've considered
I also tried to fork and npm-link the devalue package for sveltekit (to provide default reducers/revivers for sveltekit), but superforms is using 4.3.3 and sveltekit 5.0.0 (which may still be different in the future). Even if I "override" the dependency to use 5.0.0, this one instantiated in a different (memory) context and default reducers/revivers working for sveltekit are empty for superforms - so "no go".
Additional context
None
The text was updated successfully, but these errors were encountered: