Skip to content

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

Fix UI folder row issue with multiple onClick events triggered before the redirect occurs

Carlos Monastyrski2baadf60d1e3
diff --git a/frontend/src/pages/secret-manager/OverviewPage/components/SecretOverviewFolderRow/SecretOverviewFolderRow.tsx b/frontend/src/pages/secret-manager/OverviewPage/components/SecretOverviewFolderRow/SecretOverviewFolderRow.tsx
index f8023f7052..0cf62e1d67 100644
--- a/frontend/src/pages/secret-manager/OverviewPage/components/SecretOverviewFolderRow/SecretOverviewFolderRow.tsx
+++ b/frontend/src/pages/secret-manager/OverviewPage/components/SecretOverviewFolderRow/SecretOverviewFolderRow.tsx
@@ -1,3 +1,4 @@
+import { useState } from "react";
import { faCheck, faFolder, faPencil, faXmark } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { twMerge } from "tailwind-merge";
@@ -23,8 +24,19 @@ export const SecretOverviewFolderRow = ({
onToggleFolderEdit,
onClick
}: Props) => {
+ const [isClicking, setIsClicking] = useState(false);
+ const handleClick = () => {
+ if (isClicking) return;
+
+ setIsClicking(true);
+ try {
+ onClick(folderName);
+ } finally {
+ setTimeout(() => setIsClicking(false), 1000);
+ }
+ };
return (
- <Tr isHoverable isSelectable className="group" onClick={() => onClick(folderName)}>
+ <Tr isHoverable isSelectable className="group" onClick={handleClick}>
<Td className="sticky left-0 z-10 border-0 bg-mineshaft-800 bg-clip-padding p-0 group-hover:bg-mineshaft-700">
<div className="flex items-center space-x-5 border-r border-mineshaft-600 px-5 py-2.5">
<div className="text-yellow-700">