From 9ac147a14051a5c350527a7080316d6f15c84b91 Mon Sep 17 00:00:00 2001 From: Mauricio Siu Date: Tue, 3 Mar 2026 22:37:42 -0600 Subject: [PATCH] refactor: replace authClient with api.organization.active for active organization queries Updated components to use the new API method for fetching the active organization, improving consistency across the codebase. This change enhances maintainability and aligns with recent API updates. --- .../dashboard/organization/handle-organization.tsx | 5 +---- .../settings/git/github/add-github-provider.tsx | 11 ++++------- .../dashboard/settings/users/add-invitation.tsx | 2 +- apps/dokploy/components/layouts/side.tsx | 3 +-- apps/dokploy/server/api/routers/organization.ts | 9 +++++++++ 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/apps/dokploy/components/dashboard/organization/handle-organization.tsx b/apps/dokploy/components/dashboard/organization/handle-organization.tsx index c191bead5..ecc3e7c9c 100644 --- a/apps/dokploy/components/dashboard/organization/handle-organization.tsx +++ b/apps/dokploy/components/dashboard/organization/handle-organization.tsx @@ -24,7 +24,6 @@ import { FormMessage, } from "@/components/ui/form"; import { Input } from "@/components/ui/input"; -import { authClient } from "@/lib/auth-client"; import { api } from "@/utils/api"; const organizationSchema = z.object({ @@ -55,8 +54,6 @@ export function AddOrganization({ organizationId }: Props) { const { mutateAsync, isPending } = organizationId ? api.organization.update.useMutation() : api.organization.create.useMutation(); - const { refetch: refetchActiveOrganization } = - authClient.useActiveOrganization(); const form = useForm({ resolver: zodResolver(organizationSchema), @@ -89,7 +86,7 @@ export function AddOrganization({ organizationId }: Props) { utils.organization.all.invalidate(); if (organizationId) { utils.organization.one.invalidate({ organizationId }); - refetchActiveOrganization(); + utils.organization.active.invalidate(); } setOpen(false); }) diff --git a/apps/dokploy/components/dashboard/settings/git/github/add-github-provider.tsx b/apps/dokploy/components/dashboard/settings/git/github/add-github-provider.tsx index 510a0c7f6..d29b3a345 100644 --- a/apps/dokploy/components/dashboard/settings/git/github/add-github-provider.tsx +++ b/apps/dokploy/components/dashboard/settings/git/github/add-github-provider.tsx @@ -17,7 +17,8 @@ import { api } from "@/utils/api"; export const AddGithubProvider = () => { const [isOpen, setIsOpen] = useState(false); - const { data: activeOrganization } = authClient.useActiveOrganization(); + const { data: activeOrganization } = api.organization.active.useQuery(); + const { data: session } = authClient.useSession(); const { data } = api.user.get.useQuery(); const [manifest, setManifest] = useState(""); @@ -52,7 +53,7 @@ export const AddGithubProvider = () => { ); setManifest(manifest); - }, [data?.id, activeOrganization?.id, session?.user?.id]); + }, [activeOrganization?.id, session?.user?.id]); return ( @@ -131,11 +132,7 @@ export const AddGithubProvider = () => { Unsure if you already have an app?