Skip to content

Commit 1318990

Browse files
committed
fix: set onBeforeSubmit to null to prevent implicit handler in stories
1 parent 8581bd9 commit 1318990

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/components/Form/Form.stories.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,9 @@ const ungroupedContent = {
302302
} as const;
303303

304304
export default {
305+
args: {
306+
onBeforeSubmit: null
307+
},
305308
component: Form,
306309
decorators: [
307310
(Story) => (

src/components/Form/Form.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ type FormProps<TSchema extends z.ZodType<FormDataType>, TData extends z.TypeOf<T
3939
fieldsFooter?: React.ReactNode;
4040
id?: string;
4141
initialValues?: PartialNullableFormDataType<NoInfer<TData>>;
42-
onBeforeSubmit?: (data: NoInfer<TData>) => Promisable<{ errorMessage: string; success: false } | { success: true }>;
42+
onBeforeSubmit?:
43+
| ((data: NoInfer<TData>) => Promisable<{ errorMessage: string; success: false } | { success: true }>)
44+
| null;
4345
onError?: (error: z.ZodError<NoInfer<TData>>) => void;
4446
onSubmit: (data: NoInfer<TData>) => Promisable<void>;
4547
preventResetValuesOnReset?: boolean;

0 commit comments

Comments
 (0)