Skip to content

Scheduling infrastructure for absolutely everyone.

fix: disable button and handle submit when loading (#5496)

Udit Takkard7226fc3d4b2
diff --git a/packages/features/ee/teams/components/CreateANewTeamForm.tsx b/packages/features/ee/teams/components/CreateANewTeamForm.tsx
index fe22a13f374..ba265fb950f 100644
--- a/packages/features/ee/teams/components/CreateANewTeamForm.tsx
+++ b/packages/features/ee/teams/components/CreateANewTeamForm.tsx
@@ -38,7 +38,11 @@ export const CreateANewTeamForm = () => {
return (
<>
- <Form form={newTeamFormMethods} handleSubmit={(v) => createTeamMutation.mutate(v)}>
+ <Form
+ form={newTeamFormMethods}
+ handleSubmit={(v) => {
+ if (!createTeamMutation.isLoading) createTeamMutation.mutate(v);
+ }}>
<div className="mb-8">
<Controller
name="name"
@@ -113,10 +117,19 @@ export const CreateANewTeamForm = () => {
</div>
<div className="flex space-x-2">
- <Button color="secondary" href="/settings" className="w-full justify-center">
+ <Button
+ disabled={createTeamMutation.isLoading}
+ color="secondary"
+ href="/settings"
+ className="w-full justify-center">
{t("cancel")}
</Button>
- <Button color="primary" type="submit" EndIcon={Icon.FiArrowRight} className="w-full justify-center">
+ <Button
+ disabled={createTeamMutation.isLoading}
+ color="primary"
+ type="submit"
+ EndIcon={Icon.FiArrowRight}
+ className="w-full justify-center">
{t("continue")}
</Button>
</div>