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} workspaceId={workspaceId}
secretPath={secretPath} secretPath={secretPath}
onNavigateToFolder={handleResetFilter} onNavigateToFolder={handleResetFilter}
canNavigate={isFetched}
/> />
)} )}
{canReadDynamicSecret && Boolean(dynamicSecrets?.length) && ( {canReadDynamicSecret && Boolean(dynamicSecrets?.length) && (

View File

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