From d721a46ec918038061e5bcc09c5df174ecf77b50 Mon Sep 17 00:00:00 2001 From: = Date: Mon, 13 Jan 2025 12:27:18 +0530 Subject: [PATCH] fix: resolved secret and approval count triggered for other project types --- .../layouts/ProjectLayout/ProjectLayout.tsx | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/frontend/src/layouts/ProjectLayout/ProjectLayout.tsx b/frontend/src/layouts/ProjectLayout/ProjectLayout.tsx index a41e13cdb..1f73202bd 100644 --- a/frontend/src/layouts/ProjectLayout/ProjectLayout.tsx +++ b/frontend/src/layouts/ProjectLayout/ProjectLayout.tsx @@ -46,8 +46,19 @@ export const ProjectLayout = () => { const workspaceId = currentWorkspace?.id || ""; const projectSlug = currentWorkspace?.slug || ""; - const { data: secretApprovalReqCount } = useGetSecretApprovalRequestCount({ workspaceId }); - const { data: accessApprovalRequestCount } = useGetAccessRequestsCount({ projectSlug }); + const isSecretManager = currentWorkspace?.type === ProjectType.SecretManager; + const isCertManager = currentWorkspace?.type === ProjectType.CertificateManager; + const isCmek = currentWorkspace?.type === ProjectType.KMS; + const isSSH = currentWorkspace?.type === ProjectType.SSH; + + const { data: secretApprovalReqCount } = useGetSecretApprovalRequestCount({ + workspaceId, + options: { enabled: isSecretManager } + }); + const { data: accessApprovalRequestCount } = useGetAccessRequestsCount({ + projectSlug, + options: { enabled: isSecretManager } + }); const pendingRequestsCount = (secretApprovalReqCount?.open || 0) + (accessApprovalRequestCount?.pendingCount || 0); @@ -86,11 +97,6 @@ export const ProjectLayout = () => { ); } - const isSecretManager = currentWorkspace?.type === ProjectType.SecretManager; - const isCertManager = currentWorkspace?.type === ProjectType.CertificateManager; - const isCmek = currentWorkspace?.type === ProjectType.KMS; - const isSSH = currentWorkspace?.type === ProjectType.SSH; - return ( <>