From 891283289b563337199d9b2b31e6a65c6ca4e15d Mon Sep 17 00:00:00 2001 From: Woody Lin Date: Tue, 13 Oct 2026 15:36:46 +0800 Subject: [PATCH] fix: drop per-error toasts from dynamic form validation Each JSON Schema error on submit raised a persistent toast whose description was the raw error path (e.g. `[3.subject]`). Since #653 records error toasts, these flooded the notification centre and QA reported the path as a bug. The same errors are already shown inline under their fields with the first one focused, so remove the toasts and the state that only fed them. Server-side failures still toast via each action's toast.promise. --- src/lib/components/dynamic-form/form.svelte | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/lib/components/dynamic-form/form.svelte b/src/lib/components/dynamic-form/form.svelte index a15e3d33..dcd6473f 100644 --- a/src/lib/components/dynamic-form/form.svelte +++ b/src/lib/components/dynamic-form/form.svelte @@ -112,12 +112,11 @@ objectTemplate: ObjectTemplate }); - let validationResult: ValidationResult | null = $state(null); function validator(options: ValidatorFactoryOptions) { const validator = defaults.validator(options); return { ...validator, - validateFormValue(schema: Schema, formValue: FormValue) { + validateFormValue(schema: Schema, formValue: FormValue): ValidationResult { let value = {} as FormValue; switch (mode) { case 'yaml': @@ -127,18 +126,7 @@ value = formValue; break; } - const transferredValue = transfer(value); - validationResult = validator.validateFormValue(schema, transferredValue); - if (validationResult && validationResult.errors && validationResult.errors.length > 0) { - validationResult.errors.forEach((error) => { - toast.error(error.message, { - description: `[${error.path.join('.')}]`, - duration: Number.POSITIVE_INFINITY, - closeButton: true - }); - }); - } - return validationResult; + return validator.validateFormValue(schema, transfer(value)); } } satisfies FormValueValidator; }