diff --git a/apps/dokploy/components/dashboard/project/advanced-environment-selector.tsx b/apps/dokploy/components/dashboard/project/advanced-environment-selector.tsx index d10ab6558..033231fc8 100644 --- a/apps/dokploy/components/dashboard/project/advanced-environment-selector.tsx +++ b/apps/dokploy/components/dashboard/project/advanced-environment-selector.tsx @@ -59,26 +59,10 @@ export const AdvancedEnvironmentSelector = ({ }, ); - const { data: currentUser } = api.user.get.useQuery(); - - // Check if user can delete environments - const canDeleteEnvironments = - currentUser?.role === "owner" || - currentUser?.role === "admin" || - currentUser?.canDeleteEnvironments === true; - // Form states const [name, setName] = useState(""); const [description, setDescription] = useState(""); - // API mutations - const { data: environment } = api.environment.one.useQuery( - { environmentId: currentEnvironmentId || "" }, - { - enabled: !!currentEnvironmentId, - }, - ); - // Get current user's permissions const { data: currentUser } = api.user.get.useQuery(); @@ -88,6 +72,12 @@ export const AdvancedEnvironmentSelector = ({ currentUser?.role === "admin" || currentUser?.canCreateEnvironments === true; + // Check if user can delete environments + const canDeleteEnvironments = + currentUser?.role === "owner" || + currentUser?.role === "admin" || + currentUser?.canDeleteEnvironments === true; + const haveServices = selectedEnvironment && ((selectedEnvironment?.mariadb?.length || 0) > 0 ||