From afc5ea43dae0069ef1dc3e6ab6db1f7f6f61c4da Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Sat, 12 Oct 2024 16:19:49 -0600 Subject: [PATCH] fix(compose): refetch compose file when enter to the modal to prevent show duplicate labels --- .../compose/general/show-converted-compose.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/apps/dokploy/components/dashboard/compose/general/show-converted-compose.tsx b/apps/dokploy/components/dashboard/compose/general/show-converted-compose.tsx index bb01badc..ec441e02 100644 --- a/apps/dokploy/components/dashboard/compose/general/show-converted-compose.tsx +++ b/apps/dokploy/components/dashboard/compose/general/show-converted-compose.tsx @@ -11,7 +11,7 @@ import { } from "@/components/ui/dialog"; import { api } from "@/utils/api"; import { Puzzle, RefreshCw } from "lucide-react"; -import { useState } from "react"; +import { useEffect, useState } from "react"; import { toast } from "sonner"; interface Props { @@ -34,6 +34,16 @@ export const ShowConvertedCompose = ({ composeId }: Props) => { const { mutateAsync, isLoading } = api.compose.fetchSourceType.useMutation(); + useEffect(() => { + if (isOpen) { + mutateAsync({ composeId }) + .then(() => { + refetch(); + }) + .catch((err) => {}); + } + }, [isOpen]); + return (