Skip to content

Commit 5c225c8

Browse files
committed
fix(modal): close the modal after the creation #509
1 parent 0b2b20c commit 5c225c8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

apps/dokploy/components/dashboard/project/add-compose.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import { slugify } from "@/lib/slug";
3939
import { api } from "@/utils/api";
4040
import { zodResolver } from "@hookform/resolvers/zod";
4141
import { CircuitBoard, HelpCircle } from "lucide-react";
42-
import { useEffect } from "react";
42+
import { useEffect, useState } from "react";
4343
import { useForm } from "react-hook-form";
4444
import { toast } from "sonner";
4545
import { z } from "zod";
@@ -71,6 +71,7 @@ interface Props {
7171

7272
export const AddCompose = ({ projectId, projectName }: Props) => {
7373
const utils = api.useUtils();
74+
const [visible, setVisible] = useState(false);
7475
const slug = slugify(projectName);
7576
const { data: servers } = api.server.withSSHKey.useQuery();
7677
const { mutateAsync, isLoading, error, isError } =
@@ -101,6 +102,7 @@ export const AddCompose = ({ projectId, projectName }: Props) => {
101102
})
102103
.then(async () => {
103104
toast.success("Compose Created");
105+
setVisible(false);
104106
await utils.project.one.invalidate({
105107
projectId,
106108
});
@@ -111,7 +113,7 @@ export const AddCompose = ({ projectId, projectName }: Props) => {
111113
};
112114

113115
return (
114-
<Dialog>
116+
<Dialog open={visible} onOpenChange={setVisible}>
115117
<DialogTrigger className="w-full">
116118
<DropdownMenuItem
117119
className="w-full cursor-pointer space-x-3"

0 commit comments

Comments
 (0)