From 659900a48420b07a578a2b974ad4295322161a5e Mon Sep 17 00:00:00 2001 From: Victor Santos Date: Tue, 4 Nov 2025 16:54:06 -0300 Subject: [PATCH] feat: add error notifications for invalid project ID and secret references in InfisicalSecretInput --- .../InfisicalSecretInput.tsx | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/frontend/src/components/v2/InfisicalSecretInput/InfisicalSecretInput.tsx b/frontend/src/components/v2/InfisicalSecretInput/InfisicalSecretInput.tsx index 98f42923a..c5c119896 100644 --- a/frontend/src/components/v2/InfisicalSecretInput/InfisicalSecretInput.tsx +++ b/frontend/src/components/v2/InfisicalSecretInput/InfisicalSecretInput.tsx @@ -4,6 +4,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import * as Popover from "@radix-ui/react-popover"; import { useNavigate } from "@tanstack/react-router"; +import { createNotification } from "@app/components/notifications"; import { ROUTE_PATHS } from "@app/const/routes"; import { useProject } from "@app/context"; import { useDebounce, useToggle } from "@app/hooks"; @@ -312,6 +313,22 @@ export const InfisicalSecretInput = forwardRef( const handleClickSegment = useCallback( (segment: string, allSegments: string[]) => { + if (!projectId) { + createNotification({ + text: "Project ID is not set", + type: "error" + }); + return; + } + + if (allSegments.length === 0) { + createNotification({ + text: "Invalid secret reference", + type: "error" + }); + return; + } + if (allSegments.length === 1) { navigate({ search: (prev) => ({ @@ -330,6 +347,14 @@ export const InfisicalSecretInput = forwardRef( if (allSegments.length > 2) { const pathSegments = allSegments.slice(1, -1); for (let i = 0; i < pathSegments.length; i += 1) { + if (!pathSegments[i]) { + createNotification({ + text: "Invalid secret reference", + type: "error" + }); + return; + } + const pathSegment = pathSegments[i]; folderPath += `${pathSegment}`; if (pathSegment === segment) {