Merge pull request #4676 from Infisical/fix/overviewEditRowFetchSecret

Fix secret value fetching to prioritize folder secrets over imported ones
This commit is contained in:
carlosmonastyrski
2025-10-14 21:09:08 -03:00
committed by GitHub
2 changed files with 19 additions and 15 deletions

View File

@@ -82,6 +82,7 @@ type Props = {
isImported: boolean;
}[];
}[];
isSecretPresent?: boolean;
};
export const SecretEditRow = ({
@@ -101,7 +102,8 @@ export const SecretEditRow = ({
isRotatedSecret,
importedBy,
importedSecret,
isEmpty
isEmpty,
isSecretPresent
}: Props) => {
const { handlePopUpOpen, handlePopUpToggle, handlePopUpClose, popUp } = usePopUp([
"editSecret"
@@ -113,20 +115,21 @@ export const SecretEditRow = ({
const [isFieldFocused, setIsFieldFocused] = useToggle();
const fetchSecretValueParams = importedSecret
? {
environment: importedSecret.environment,
secretPath: importedSecret.secretPath,
secretKey: importedSecret.secret?.key ?? "",
projectId: currentProject.id
}
: {
environment,
secretPath,
secretKey: secretName,
projectId: currentProject.id,
isOverride
};
const fetchSecretValueParams =
importedSecret && !isSecretPresent
? {
environment: importedSecret.environment,
secretPath: importedSecret.secretPath,
secretKey: importedSecret.secret?.key ?? "",
projectId: currentProject.id
}
: {
environment,
secretPath,
secretKey: secretName,
projectId: currentProject.id,
isOverride
};
// scott: only fetch value if secret exists, has non-empty value and user has permission
const canFetchValue = Boolean(importedSecret ?? secretId) && !isEmpty && !secretValueHidden;

View File

@@ -284,6 +284,7 @@ export const SecretOverviewTableRow = ({
environment={slug}
isRotatedSecret={secret?.isRotatedSecret}
importedBy={importedBy}
isSecretPresent={Boolean(secret)}
/>
</td>
</tr>