v1.0.0-rc.1
Pre-release
Pre-release
Read the announcement and migration guide here: https://github.com/ciscoheat/sveltekit-superforms/discussions/168
Changed
- Explicitly setting a form
idfor multiple forms is not required anymore when usinguse:enhance, unless the forms are using the same schema. An id can be specified in the options or in a hidden form field called__superform_id. setErrordoesn't handle form-level errors anymore, use refine/superRefine on the schema, or themessagehelper.FieldPathis gone - the following methods are now using a string accessor liketags[2].idinstead of an array like['tags', 2, 'id']:validate,setErrorand all proxy methods (ending withProxy). This also applies to generic components.- The signature for
allErrorsandfirstErrorhas changed to{ path: string; messages: string[] }. - The literal
"any"is now an allowed value instepfor constraints. - Multiple
regexandstepis now allowed in a schema. A warning will be emitted by default, that can be turned off. - The signature for
options.resetFormhas changed toboolean | () => boolean(it was async before). - The undocumented
defaultDatais now calleddefaultValues. - Added
[aria-invalid="true"]toerrorSelectoroption. options.resetFormnow works withoutuse:enhance!
Removed
options.noErrorsis removed. Useoptions.errorsinstead.- The virtually unused
metahas been removed. Use the Zod schema directly instead for reflection.
Fixed
- Fixed deprecation notices for
use:enhance.
Added
- Added
superValidateSync, useful in components for SPA:s. - Added
defaultValues, which takes a schema and returns the default values for it. - Support for
ZodPipeline.