fix: prevent folder click on navigation from duplicating path addition

This commit is contained in:
Scott Wilson
2025-08-29 13:39:38 -07:00
parent cf64c89ea3
commit abb577e4e9
2 changed files with 6 additions and 10 deletions

View File

@@ -963,6 +963,7 @@ const Page = () => {
workspaceId={workspaceId}
secretPath={secretPath}
onNavigateToFolder={handleResetFilter}
canNavigate={isFetched}
/>
)}
{canReadDynamicSecret && Boolean(dynamicSecrets?.length) && (

View File

@@ -1,12 +1,5 @@
import { subject } from "@casl/ability";
import {
faClose,
faEdit,
faFolder,
faInfoCircle,
faPencilSquare,
faTrash
} from "@fortawesome/free-solid-svg-icons";
import { faClose, faEdit, faFolder, faInfoCircle, faPencilSquare, faTrash } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { useNavigate, useSearch } from "@tanstack/react-router";
import { twMerge } from "tailwind-merge";
@@ -36,6 +29,7 @@ type Props = {
workspaceId: string;
secretPath?: string;
onNavigateToFolder: (path: string) => void;
canNavigate: boolean;
};
export const FolderListView = ({
@@ -43,7 +37,8 @@ export const FolderListView = ({
environment,
workspaceId,
secretPath = "/",
onNavigateToFolder
onNavigateToFolder,
canNavigate
}: Props) => {
const { popUp, handlePopUpToggle, handlePopUpOpen, handlePopUpClose } = usePopUp([
"updateFolder",
@@ -190,7 +185,7 @@ export const FolderListView = ({
};
const handleFolderClick = (name: string, isPending?: boolean) => {
if (isPending) {
if (isPending || !canNavigate) {
return;
}
const path = `${secretPathQueryparam === "/" ? "" : secretPathQueryparam}/${name}`;