Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix(cert-manager): only confirm Copy ID after the clipboard write succeeds

Carlos Monastyrskia71fed991e25
diff --git a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationSettingsTab.tsx b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationSettingsTab.tsx
index a4f146f6c8..9a38ee3b65 100644
--- a/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationSettingsTab.tsx
+++ b/frontend/src/pages/cert-manager/ApplicationDetailsByIDPage/components/ApplicationSettingsTab.tsx
@@ -130,11 +130,15 @@ const ApplicationPolicyActionsMenu = ({
}: ApplicationPolicyActionsMenuProps) => {
const [isIdCopied, setIsIdCopied] = useToggle(false);
- const handleCopyId = () => {
- navigator.clipboard.writeText(policy.id);
- setIsIdCopied.on();
- createNotification({ type: "info", text: "Approval policy ID copied to clipboard" });
- setTimeout(() => setIsIdCopied.off(), 2000);
+ const handleCopyId = async () => {
+ try {
+ await navigator.clipboard.writeText(policy.id);
+ setIsIdCopied.on();
+ createNotification({ type: "info", text: "Approval policy ID copied to clipboard" });
+ setTimeout(() => setIsIdCopied.off(), 2000);
+ } catch {
+ createNotification({ type: "error", text: "Could not copy to clipboard" });
+ }
};
return (
diff --git a/frontend/src/pages/cert-manager/ApprovalsPage/components/PolicyTab/components/PoliciesTable.tsx b/frontend/src/pages/cert-manager/ApprovalsPage/components/PolicyTab/components/PoliciesTable.tsx
index d9156d4e00..3413eca79f 100644
--- a/frontend/src/pages/cert-manager/ApprovalsPage/components/PolicyTab/components/PoliciesTable.tsx
+++ b/frontend/src/pages/cert-manager/ApprovalsPage/components/PolicyTab/components/PoliciesTable.tsx
@@ -60,11 +60,15 @@ const PolicyActionsMenu = ({
}) => {
const [isIdCopied, setIsIdCopied] = useToggle(false);
- const handleCopyId = () => {
- navigator.clipboard.writeText(policy.id);
- setIsIdCopied.on();
- createNotification({ type: "info", text: "Approval policy ID copied to clipboard" });
- setTimeout(() => setIsIdCopied.off(), 2000);
+ const handleCopyId = async () => {
+ try {
+ await navigator.clipboard.writeText(policy.id);
+ setIsIdCopied.on();
+ createNotification({ type: "info", text: "Approval policy ID copied to clipboard" });
+ setTimeout(() => setIsIdCopied.off(), 2000);
+ } catch {
+ createNotification({ type: "error", text: "Could not copy to clipboard" });
+ }
};
return (
diff --git a/frontend/src/pages/cert-manager/components/CertificateAlerts/CertificateAlertsCard.tsx b/frontend/src/pages/cert-manager/components/CertificateAlerts/CertificateAlertsCard.tsx
index 860c445df6..e941635593 100644
--- a/frontend/src/pages/cert-manager/components/CertificateAlerts/CertificateAlertsCard.tsx
+++ b/frontend/src/pages/cert-manager/components/CertificateAlerts/CertificateAlertsCard.tsx
@@ -164,11 +164,15 @@ const AlertRow = ({
const { mutate: updateAlert } = useUpdateAlert();
const [isIdCopied, setIsIdCopied] = useToggle(false);
- const handleCopyId = () => {
- navigator.clipboard.writeText(alert.id);
- setIsIdCopied.on();
- createNotification({ type: "info", text: "Alert ID copied to clipboard" });
- setTimeout(() => setIsIdCopied.off(), 2000);
+ const handleCopyId = async () => {
+ try {
+ await navigator.clipboard.writeText(alert.id);
+ setIsIdCopied.on();
+ createNotification({ type: "info", text: "Alert ID copied to clipboard" });
+ setTimeout(() => setIsIdCopied.off(), 2000);
+ } catch {
+ createNotification({ type: "error", text: "Could not copy to clipboard" });
+ }
};
const handleToggleAlert = () =>