Skip to content

Commit 4ccc64d

Browse files
committed
fix(valibot): dynamically import safeParseAsync for improved performance
1 parent 974f908 commit 4ccc64d

File tree

1 file changed

+2
-1
lines changed
  • headless/src/forms/resolvers/valibot

1 file changed

+2
-1
lines changed

headless/src/forms/resolvers/valibot/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { safeParseAsync } from 'valibot';
21
import type { BaseIssue, BaseSchema, BaseSchemaAsync, InferOutput } from 'valibot';
32
import { toNestError } from '../../core/shared';
43
import type { FormErrors } from '../../core/types';
@@ -10,6 +9,8 @@ export type ValibotResolver = <
109
) => (values: InferOutput<T>) => Promise<FormErrors<InferOutput<T>>>;
1110

1211
export const valibotResolver: ValibotResolver = schema => async values => {
12+
const { safeParseAsync } = await import('valibot');
13+
1314
try {
1415
const result = await safeParseAsync(schema, values);
1516
if (!result.success) {

0 commit comments

Comments
 (0)