diff --git a/frontend/src/hooks/api/projects/queries.tsx b/frontend/src/hooks/api/projects/queries.tsx index 8c07ca691..b9748950b 100644 --- a/frontend/src/hooks/api/projects/queries.tsx +++ b/frontend/src/hooks/api/projects/queries.tsx @@ -191,12 +191,15 @@ export const fetchWorkspaceIntegrations = async (projectId: string) => { return data.integrations; }; -export const useGetWorkspaceIntegrations = (projectId: string) => +export const useGetWorkspaceIntegrations = ( + projectId: string, + options?: { enabled?: boolean; refetchInterval?: number | false } +) => useQuery({ queryKey: projectKeys.getProjectIntegrations(projectId), queryFn: () => fetchWorkspaceIntegrations(projectId), - enabled: Boolean(projectId), - refetchInterval: 4000 + enabled: Boolean(projectId) && (options?.enabled ?? true), + refetchInterval: options?.refetchInterval ?? 4000 }); export const createWorkspace = ( diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/components/PolicySelectionModal.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/components/PolicySelectionModal.tsx index 3505722bc..46ea296ea 100644 --- a/frontend/src/pages/project/RoleDetailsBySlugPage/components/PolicySelectionModal.tsx +++ b/frontend/src/pages/project/RoleDetailsBySlugPage/components/PolicySelectionModal.tsx @@ -47,8 +47,12 @@ type TForm = { permissions: Record }; const Content = ({ onClose, type: projectType }: ContentProps) => { const rootForm = useFormContext(); const [search, setSearch] = useState(""); - const { currentProject } = useProject(); - const { data: integrations = [] } = useGetWorkspaceIntegrations(currentProject?.id ?? ""); + const { currentProject, projectId } = useProject(); + const isSecretManagerProject = currentProject.type === ProjectType.SecretManager; + const { data: integrations = [] } = useGetWorkspaceIntegrations(projectId, { + enabled: isSecretManagerProject, + refetchInterval: false + }); const { control, diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/components/RolePermissionsSection.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/components/RolePermissionsSection.tsx index f50b39a92..e853715e0 100644 --- a/frontend/src/pages/project/RoleDetailsBySlugPage/components/RolePermissionsSection.tsx +++ b/frontend/src/pages/project/RoleDetailsBySlugPage/components/RolePermissionsSection.tsx @@ -103,13 +103,15 @@ export const renderConditionalComponents = ( }; export const RolePermissionsSection = ({ roleSlug, isDisabled }: Props) => { - const { currentProject } = useProject(); - const projectId = currentProject?.id || ""; - const { data: role, isPending } = useGetProjectRoleBySlug( - currentProject?.id ?? "", - roleSlug as string - ); - const { data: integrations = [] } = useGetWorkspaceIntegrations(projectId); + const { currentProject, projectId } = useProject(); + + const isSecretManagerProject = currentProject.type === ProjectType.SecretManager; + + const { data: role, isPending } = useGetProjectRoleBySlug(projectId, roleSlug as string); + const { data: integrations = [] } = useGetWorkspaceIntegrations(projectId, { + enabled: isSecretManagerProject, + refetchInterval: false + }); const hasNativeIntegrations = integrations.length > 0; const [showAccessTree, setShowAccessTree] = useState(null); @@ -142,8 +144,6 @@ export const RolePermissionsSection = ({ roleSlug, isDisabled }: Props) => { (role?.slug ?? "") as ProjectMembershipRole ); - const isSecretManagerProject = currentProject.type === ProjectType.SecretManager; - const permissions = form.watch("permissions"); const formattedPermissions = useMemo(