fix: anti double submit in form

This commit is contained in:
jialin
2026-06-11 20:02:27 +08:00
committed by jialin
parent 1218c6d096
commit a7b33a928b
23 changed files with 246 additions and 93 deletions
@@ -36,6 +36,7 @@ type AddModalProps = {
provider: ProviderType;
credentialList: Global.BaseOption<number>[];
onFinish: (values: FormData) => void;
onFinishFailed?: (errorInfo: any) => void;
// Reports whether the user has changed any k8s_options field, so the parent
// can show the "re-run registration" notice in the footer.
onK8sOptionsChange?: (changed: boolean) => void;
@@ -49,6 +50,7 @@ const ClusterForm: React.FC<AddModalProps> = forwardRef(
currentData,
credentialList,
onFinish,
onFinishFailed,
onK8sOptionsChange
},
ref
@@ -212,8 +214,9 @@ const ClusterForm: React.FC<AddModalProps> = forwardRef(
}
}));
const handleOnFinishFailed = () => {
const handleOnFinishFailed = (errorInfo: any) => {
setSubmitAttempted(true);
onFinishFailed?.(errorInfo);
};
return (