From ce632b1482220f3f4bcb713373b8b119b8eff2a7 Mon Sep 17 00:00:00 2001 From: SKairinos Date: Fri, 21 Jul 2023 12:26:10 +0100 Subject: [PATCH] fix: async schema validation --- src/components/form/CheckboxField.tsx | 2 +- src/components/form/TextField.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/form/CheckboxField.tsx b/src/components/form/CheckboxField.tsx index 6bd53873..a7a6970f 100644 --- a/src/components/form/CheckboxField.tsx +++ b/src/components/form/CheckboxField.tsx @@ -51,7 +51,7 @@ const CheckboxField: React.FC = ({ validate: async (value) => { if (validate instanceof BooleanSchema) { try { - validate.validateSync(value); + await validate.validate(value); } catch (error) { if (error instanceof ValidationError) { return error.errors[0]; diff --git a/src/components/form/TextField.tsx b/src/components/form/TextField.tsx index 64ed2920..f1c167a3 100644 --- a/src/components/form/TextField.tsx +++ b/src/components/form/TextField.tsx @@ -75,7 +75,7 @@ const _TextField: React.FC { if (validate instanceof Schema) { try { - validate.validateSync(value); + await validate.validate(value); } catch (error) { if (error instanceof ValidationError) { return error.errors[0];