diff --git a/apps/dashboard/app/(app)/apis/[apiId]/settings/delete-api.tsx b/apps/dashboard/app/(app)/apis/[apiId]/settings/delete-api.tsx index b4629fa8ec..939bdef2fd 100644 --- a/apps/dashboard/app/(app)/apis/[apiId]/settings/delete-api.tsx +++ b/apps/dashboard/app/(app)/apis/[apiId]/settings/delete-api.tsx @@ -1,7 +1,7 @@ "use client"; import { Button } from "@/components/ui/button"; import type React from "react"; -import { useState } from "react"; +import { useEffect, useState } from "react"; import { Card, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"; import { Input } from "@/components/ui/input"; @@ -84,6 +84,13 @@ export const DeleteApi: React.FC = ({ api, keys }) => { deleteApi.mutate({ apiId: api.id }); } + // useEffect to reset form fields when dialog is closed + useEffect(() => { + if (!open) { + form.reset(); // Reset form when the dialog is closed + } + }, [open, form.reset]); // Run this whenever `open` changes + return ( <>