Skip to content

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

fix: addressed suggestion issue in copy secrets from board

Sheen Capadngan2b0670a4094d
diff --git a/frontend/src/components/v2/SecretPathInput/SecretPathInput.tsx b/frontend/src/components/v2/SecretPathInput/SecretPathInput.tsx
index fb110c2e70..1024a5c085 100644
--- a/frontend/src/components/v2/SecretPathInput/SecretPathInput.tsx
+++ b/frontend/src/components/v2/SecretPathInput/SecretPathInput.tsx
@@ -1,4 +1,4 @@
-import { InputHTMLAttributes, useEffect, useRef, useState } from "react";
+import { InputHTMLAttributes, useEffect, useState } from "react";
import { faFolder } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import * as Popover from "@radix-ui/react-popover";
@@ -31,7 +31,6 @@ export const SecretPathInput = ({
const [secretPath, setSecretPath] = useState("/");
const [suggestions, setSuggestions] = useState<string[]>([]);
const [highlightedIndex, setHighlightedIndex] = useState(-1);
- const inputRef = useRef<HTMLInputElement>(null);
const debouncedInputValue = useDebounce(inputValue, 200);
const { currentWorkspace } = useWorkspace();
@@ -88,6 +87,7 @@ export const SecretPathInput = ({
setInputValue(newValue);
setSecretPath(newValue);
setHighlightedIndex(-1);
+ setSuggestions([]);
};
const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
@@ -125,7 +125,6 @@ export const SecretPathInput = ({
{...props}
type="text"
autoComplete="off"
- ref={inputRef}
onKeyDown={handleKeyDown}
value={inputValue}
onChange={handleInputChange}
diff --git a/frontend/src/views/SecretMainPage/components/SecretDropzone/CopySecretsFromBoard.tsx b/frontend/src/views/SecretMainPage/components/SecretDropzone/CopySecretsFromBoard.tsx
index b00bae4214..1d83f591b5 100644
--- a/frontend/src/views/SecretMainPage/components/SecretDropzone/CopySecretsFromBoard.tsx
+++ b/frontend/src/views/SecretMainPage/components/SecretDropzone/CopySecretsFromBoard.tsx
@@ -77,7 +77,6 @@ export const CopySecretsFromBoard = ({
handleSubmit,
control,
watch,
- register,
reset,
setValue,
formState: { isDirty }
@@ -193,13 +192,19 @@ export const CopySecretsFromBoard = ({
</FormControl>
)}
/>
- <FormControl label="Secret Path" className="flex-grow" isRequired>
- <SecretPathInput
- {...register("secretPath")}
- placeholder="Provide a path, default is /"
- environment={selectedEnvSlug}
- />
- </FormControl>
+ <Controller
+ control={control}
+ name="secretPath"
+ render={({ field }) => (
+ <FormControl label="Secret Path" className="flex-grow" isRequired>
+ <SecretPathInput
+ {...field}
+ placeholder="Provide a path, default is /"
+ environment={selectedEnvSlug}
+ />
+ </FormControl>
+ )}
+ />
</div>
<div className="border-t border-mineshaft-600 pt-4">
<div className="mb-4 flex items-center justify-between">