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
id
for 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
. setError
doesn't handle form-level errors anymore, use refine/superRefine on the schema, or themessage
helper.FieldPath
is gone - the following methods are now using a string accessor liketags[2].id
instead of an array like['tags', 2, 'id']
:validate
,setError
and all proxy methods (ending withProxy
). This also applies to generic components.- The signature for
allErrors
andfirstError
has changed to{ path: string; messages: string[] }
. - The literal
"any"
is now an allowed value instep
for constraints. - Multiple
regex
andstep
is now allowed in a schema. A warning will be emitted by default, that can be turned off. - The signature for
options.resetForm
has changed toboolean | () => boolean
(it was async before). - The undocumented
defaultData
is now calleddefaultValues
. - Added
[aria-invalid="true"]
toerrorSelector
option. options.resetForm
now works withoutuse:enhance
!
Removed
options.noErrors
is removed. Useoptions.errors
instead.- The virtually unused
meta
has 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
.