Skip to content

Releases: ciscoheat/sveltekit-superforms

v2.14.0

25 May 22:46
Compare
Choose a tag to compare

Added

  • errorMap option for the Zod adapter, for simplified error handling in localization. (Zod docs)

Fixed

  • isTainted now works with undefined values in the $tainted store.
  • Fixed default properties for Record in schemas.

v2.13.1

07 May 08:59
Compare
Choose a tag to compare

Fixed

  • FormPath et al. now extends only basic objects and arrays, avoiding issues with classes, all built-in objects like File and Date, and special "branded" types that validation libraries are using. Thanks to Matt DeKok for this fix!
  • SuperDebug always renders left-to-right now.
  • Discriminated unions for the form itself weren't including the union keys for the schema, when parsing the form data.
  • devalue updated to ^5.0.0 to handle invalid dates.

v2.13.0

03 May 09:36
Compare
Choose a tag to compare

Added

  • Support for "raw" JSON Schema validation with the new schemasafe adapter. Thanks to sukeshpabolu for the initial work on this!

Fixed

  • Errors weren't reset properly when the form was resetted, causing client-side validation to behave like the field was tainted.

v2.12.6

23 Apr 20:22
Compare
Choose a tag to compare

Fixed

  • The Zod adapter didn't handle reused schemas ($ref) properly.
  • The "GET to POST" modification for use:enhance was only intended for SPA mode to fully support progressive enhancement, so it now properly checks for that before adding the missing method="POST" attribute on the form.
  • The tainted message didn't trigger on page refresh or closing a tab in the browser.
  • FormPathLeaves caused a memory leak when using svelte-package.

v2.12.3

08 Apr 07:26
Compare
Choose a tag to compare

Fixed

  • SuperDebug support for Map and Set.
  • submit method now falls back to submit, if no support for requestSubmit in browser.
  • isTainted now handles the type of $tainted in generic components.
  • id option for superForm (not superValidate) wasn't used in multiple form scenarios.
  • Fixed FormResult type that can be used in onUpdate, it didn't filter out SuperValidated.

v2.12.0

28 Mar 09:36
46328cc
Compare
Choose a tag to compare

Migration guide: https://superforms.rocks/migration-v2
More detailed list of what's new: https://superforms.rocks/whats-new-v2

Added

  • SPA action form now supports form elements as well, by adding its use:enhance on all related forms.

Fixed

  • Fixed type inference for FormPath with nested arrays. Error output improved as well.
  • If method is "GET" or doesn't exist on an enhanced form, it's now automatically set to "POST". πŸŽ‰

v2.11.0

22 Mar 21:42
Compare
Choose a tag to compare

Migration guide: https://superforms.rocks/migration-v2
More detailed list of what's new: https://superforms.rocks/whats-new-v2

Added

  • The ActionResult for success or failure is now added to the onUpdate event in the result property. Can be used to access the ActionData more easily.
  • Added a fail function, works the same as the SvelteKit fail, but removes files and sets form.valid to false.
  • options.config added to the Zod adapter, so the JSON Schema generation can be customized.

Fixed

  • Snapshots couldn't handle files. They are now reverted to their default value when captured and restored in a snapshot, including the tainted state for these fields.

v2.10.6

20 Mar 20:08
Compare
Choose a tag to compare

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, not errors-and-message, as it didn't work anyway.

Fixed

  • the event.result.error signature in onError was incorrect, it doesn't always match App.Error. It is now a union between App.Error, The built-in JS Error 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

19 Mar 08:17
Compare
Choose a tag to compare

Migration guide: https://superforms.rocks/migration-v2
More detailed list of what's new: https://superforms.rocks/whats-new-v2

Added

  • fileProxy, filesProxy, fileFieldProxy and filesFieldProxy, so File objects can be used with bind:files on the input field. See file uploads for examples.
  • Exported FormPathLeavesWithErrors, for the setError function.

Fixed

  • Support for instance and special 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

12 Mar 00:00
Compare
Choose a tag to compare

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.