Releases: ciscoheat/sveltekit-superforms
v2.10.6
Migration guide: https://superforms.rocks/migration-v2
More detailed list of what's new: https://superforms.rocks/whats-new-v2
Changed
- The clearOnSubmit option didn't clear the errors when supposed to. To avoid a breaking change, the default option for clearOnSubmit is now
message
, noterrors-and-message
, as it didn't work anyway.
Fixed
- the
event.result.error
signature in onError was incorrect, it doesn't always matchApp.Error
. It is now a union betweenApp.Error
, The built-in JSError
class, and the default App.Error signature{ message: string }
. See the server errors section for examples when the different kinds of errors are being created.
v2.10.5
Migration guide: https://superforms.rocks/migration-v2
More detailed list of what's new: https://superforms.rocks/whats-new-v2
Added
fileProxy
,filesProxy
,fileFieldProxy
andfilesFieldProxy
, soFile
objects can be used withbind:files
on the input field. See file uploads for examples.- Exported
FormPathLeavesWithErrors
, for thesetError
function.
Fixed
- Support for
instance
andspecial
validators for Valibot, which now enables File validation for Valibot! taintedMessage
didn't always work when navigating with the History API.tainted
didn't untaint automatically when using arrays.- Client-side validation triggered for incorrect fields when starting with the same name.
v2.9.0
Migration guide: https://superforms.rocks/migration-v2
More detailed list of what's new: https://superforms.rocks/whats-new-v2
Added
- "SPA action mode", the
SPA
option can now take a string, corresponding to a form action, and it will post there, even without a html form on the page. Especially useful for debounced server checks like available usernames. Example here
Fixed
- Fixed types for constraints, tainted and errors when using intersections and unions in schemas.
- Fixed SuperDebug collapsed height by preventing global css leak.
- Redirect in SPA mode cancelled normal redirects, preventing applyAction.
- Default objects sent to
superForm
returned a form with an empty id, causing collisions, it is now a random string. customValidity
didn't clear without client-side validators.
v2.8.0
Migration guide: https://superforms.rocks/migration-v2
More detailed list of what's new: https://superforms.rocks/whats-new-v2
Added
- Support for object unions, with implicit default values.
- Experimental Storybook support.
Fixed
- It wasn't possible to directly assign
undefined
to a field in the$errors
store. - Intersections in Zod schemas weren't handled properly.
- It wasn't possible to change the reference to the result in
onResult
.
v2.7.0
Migration guide: https://superforms.rocks/migration-v2
More detailed list of what's new: https://superforms.rocks/whats-new-v2
Added
newState
option forreset
, to set a new state for future resets. Can be used instead of thedata
option.
Fixed
- Empty file entries didn't return
null
for nullable schema fields. Ensure that all required file fields aren't set to nullable. - Allowed
string
index in$errors
and$tainted
. submit
can now be passed directly to event handlers.- Updated to latest
valibot-json-schema
, with support for enums, amongst others. - Zod adapter now supports
ZodType
.
v2.6.1
Migration guide: https://superforms.rocks/migration-v2
More detailed list of what's new: https://superforms.rocks/whats-new-v2
Added
- Type narrowing for
FormPath
and its relatives, to filter the paths based on a specific type, likeFormPathLeaves<T, Date>
. - Proxy types:
FieldProxy
,FormFieldProxy
andArrayProxy
. - Added
invalidateAll
option'force'
, to always use the load function form data, instead of the one returned from the form action. Useful when updating the form data partially, to ensure that the data is refreshed from the server (a "pessimistic" update compared to the default, which is optimistic). Setting this also bases thereset
function on the latest load function data returned for the form.
Fixed
defaults
didn't infer the input type, and didn't generate correctSuperValidated
data, makingsuperForm
confused. Also fixed type signature and removed thejsonSchema
option that wasn't applicable.- Using
goto
in events didn't work when the target page redirected. FormPath
andFormPathLeaves
didn't handle fields with typeunknown
andany
.- Missing boolean fields were valid in strict mode.
v2.5.0
Migration guide: https://superforms.rocks/migration-v2
More detailed list of what's new: https://superforms.rocks/whats-new-v2
Added
get
andset
accessor foronChange
.submit
method forsuperForm
, a convenience instead of using requestSubmit. Requiresuse:enhance
or that aHTMLElement
inside the form (or the form itself) is passed as an argument.
Fixed
- Type parameter was missing in
ChangeEvent
, which should be of the inferred schema type. - Type for
onChange.paths
wasn't strongly typed toFormPath
. - Initial data was dereferenced after calling
superForm
, so it wasn't possible to update it when usingreset
. FormOptions
type required a type parameter that should've been defaulted toRecord<string, unknown>
.- Auto-overflow on SuperDebug, for small spaces.
v2.4.0
Migration guide: https://superforms.rocks/migration-v2
More detailed list of what's new: https://superforms.rocks/whats-new-v2
Added
- Added
config
option to Valibot adapter, for the SchemaConfig type.
Fixed
- Nullable fields weren't always detected in JSON Schemas.
- Constraints weren't added when using default values for Arktype, Vine and Valibot schemas.
- Fixed null support for Joi, Arktype and Vine schemas.
v2.3.0
Migration guide: https://superforms.rocks/migration-v2
More detailed list of what's new: https://superforms.rocks/whats-new-v2
Fixed
- Depending on the JSON Schema, dates were sometimes set to
undefined
when posting invalid data.
Added
onSubmit.jsonData
, to override what's being submitted, when dataType is set to'json'
and validation succeeds for$form
.onSubmit.validators
, to temporarily override validators for the current submission.
v2.2.1
Migration guide: https://superforms.rocks/migration-v2
More detailed list of what's new: https://superforms.rocks/whats-new-v2
Fixed
- Added
focusOnError
option toSuperForm.validateForm
type (it was only in the implementation). - Enums could not be detected as an invalid value if the posted value was an empty string, instead it defaulted to the enum first value.
$posted
was reset by mistake tofalse
after posting, whenresetForm
option was true.