From 9263c1a23d6a2f81934c485e97726d713ce5ac88 Mon Sep 17 00:00:00 2001 From: Carlos Monastyrski Date: Mon, 17 Nov 2025 10:47:38 -0300 Subject: [PATCH] Fix refresh issues on PKI Inventory table --- .../src/hooks/api/certificates/mutations.tsx | 23 ++++++++++++++----- frontend/src/hooks/api/certificates/types.ts | 2 ++ .../components/CertificateRevocationModal.tsx | 1 + .../components/CertificatesSection.tsx | 6 ++++- 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/frontend/src/hooks/api/certificates/mutations.tsx b/frontend/src/hooks/api/certificates/mutations.tsx index a6daf0491..f65d6adc6 100644 --- a/frontend/src/hooks/api/certificates/mutations.tsx +++ b/frontend/src/hooks/api/certificates/mutations.tsx @@ -27,9 +27,18 @@ export const useDeleteCert = () => { ); return certificate; }, - onSuccess: (_, { projectSlug }) => { + onSuccess: (_, { projectId }) => { queryClient.invalidateQueries({ - queryKey: projectKeys.forProjectCertificates(projectSlug) + queryKey: ["certificate-profiles", "list"] + }); + queryClient.invalidateQueries({ + queryKey: pkiSubscriberKeys.allPkiSubscriberCertificates() + }); + queryClient.invalidateQueries({ + queryKey: projectKeys.allProjectCertificates() + }); + queryClient.invalidateQueries({ + queryKey: projectKeys.forProjectCertificates(projectId) }); } }); @@ -49,16 +58,18 @@ export const useRevokeCert = () => { ); return certificate; }, - onSuccess: (_, { projectSlug }) => { + onSuccess: (_, { projectId }) => { queryClient.invalidateQueries({ - queryKey: projectKeys.forProjectCertificates(projectSlug) + queryKey: ["certificate-profiles", "list"] }); queryClient.invalidateQueries({ queryKey: pkiSubscriberKeys.allPkiSubscriberCertificates() }); - queryClient.invalidateQueries({ - queryKey: ["certificate-profiles", "list"] + queryKey: projectKeys.allProjectCertificates() + }); + queryClient.invalidateQueries({ + queryKey: projectKeys.forProjectCertificates(projectId) }); } }); diff --git a/frontend/src/hooks/api/certificates/types.ts b/frontend/src/hooks/api/certificates/types.ts index 5e950b9c9..52ac0d9d4 100644 --- a/frontend/src/hooks/api/certificates/types.ts +++ b/frontend/src/hooks/api/certificates/types.ts @@ -25,11 +25,13 @@ export type TCertificate = { export type TDeleteCertDTO = { projectSlug: string; + projectId: string; serialNumber: string; }; export type TRevokeCertDTO = { projectSlug: string; + projectId: string; serialNumber: string; revocationReason: string; }; diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateRevocationModal.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateRevocationModal.tsx index d9a564fb1..39198beb8 100644 --- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateRevocationModal.tsx +++ b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificateRevocationModal.tsx @@ -54,6 +54,7 @@ export const CertificateRevocationModal = ({ popUp, handlePopUpToggle }: Props) await revokeCertificate({ projectSlug: currentProject.slug, + projectId: currentProject.id, serialNumber, revocationReason }); diff --git a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsx b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsx index 7ca9b81d0..1330c5c4a 100644 --- a/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsx +++ b/frontend/src/pages/cert-manager/CertificatesPage/components/CertificatesSection.tsx @@ -42,7 +42,11 @@ export const CertificatesSection = () => { const onRemoveCertificateSubmit = async (serialNumber: string) => { if (!currentProject?.slug) return; - await deleteCert({ serialNumber, projectSlug: currentProject.slug }); + await deleteCert({ + serialNumber, + projectSlug: currentProject.slug, + projectId: currentProject.id + }); createNotification({ text: "Successfully deleted certificate",