Skip to content

Commit 419be7f

Browse files
committed
Removed update.
Changelog updated.
1 parent a240240 commit 419be7f

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,21 @@ Headlines: Added, Changed, Deprecated, Removed, Fixed, Security
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [Unreleased]
9+
10+
### Changed
11+
12+
- Client-side validators now works in realtime, based on "reward early, validate late".
13+
14+
### Removed
15+
16+
- The rarely used `update` function is removed. Use `form` instead, which now has an option for not tainting the affected fields.
17+
18+
### Added
19+
20+
- Added `validate` to `superForm`, which can be used to validate any field, at any time.
21+
- The option `{ taint: boolean }` has been added to `form.set` and `form.update`.
22+
823
## [0.7.1] - 2023-04-17
924

1025
### Fixed

src/lib/client/index.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ export type SuperForm<T extends ZodValidation<AnyZodObject>, M = any> = {
236236
el: HTMLFormElement,
237237
events?: SuperFormEvents<UnwrapEffects<T>, M>
238238
) => ReturnType<typeof formEnhance>;
239-
update: FormUpdate;
239+
240240
reset: (options?: { keepMessage: boolean }) => void;
241241

242242
capture: () => SuperFormSnapshot<UnwrapEffects<T>, M>;
@@ -552,7 +552,7 @@ export function superForm<
552552
rebind(clone(initialForm), true, message);
553553
}
554554

555-
const Data_update: FormUpdate = async (result, untaint?: boolean) => {
555+
const Form_update: FormUpdate = async (result, untaint?: boolean) => {
556556
if (result.type == ('error' as string)) {
557557
throw new SuperFormError(
558558
`ActionResult of type "${result.type}" cannot be passed to update function.`
@@ -768,7 +768,7 @@ export function superForm<
768768
Delayed,
769769
Timeout,
770770
Errors,
771-
Data_update,
771+
Form_update,
772772
options,
773773
Form,
774774
Message,
@@ -784,7 +784,6 @@ export function superForm<
784784

785785
firstError: FirstError,
786786
allErrors: AllErrors,
787-
update: Data_update,
788787
reset: (options?) =>
789788
_resetForm(options?.keepMessage ? get(Message) : undefined)
790789
};

0 commit comments

Comments
 (0)