improvements: resolve more commit state issues form value reveal change

This commit is contained in:
Scott Wilson
2025-09-18 12:09:28 -07:00
parent 120b767f16
commit 999ce3fec6
6 changed files with 13 additions and 14 deletions

View File

@@ -272,13 +272,7 @@ export const useGetSecretVersion = (dto: GetSecretVersionsDTO) =>
export const fetchSecretVersionValue = async (secretId: string, version: number) => {
const { data } = await apiRequest.get<TSecretVersionValue>(
`/api/v1/dashboard/secret-versions/${secretId}/value/${version}`,
{
params: {
secretId,
version
}
}
`/api/v1/dashboard/secret-versions/${secretId}/value/${version}`
);
return data.value;
};

View File

@@ -29,7 +29,7 @@ export const SecretOverviewRotationSecretRow = ({
const { data: secretValueData, isError } = useGetSecretValue(
{
secretKey: secret!.key,
secretKey: secret?.key ?? "",
environment,
secretPath,
projectId: currentProject.id

View File

@@ -117,7 +117,7 @@ export const SecretEditRow = ({
? {
environment: importedSecret.environment,
secretPath: importedSecret.secretPath,
secretKey: importedSecret.secret!.key,
secretKey: importedSecret.secret?.key ?? "",
projectId: currentProject.id
}
: {

View File

@@ -143,7 +143,7 @@ const RenderSecretChanges = ({ onDiscard, change }: RenderResourceProps) => {
{
version: 1, // placeholder, not used
secretKey,
secretValue
secretValue: secretValue || undefined
}
]
}}

View File

@@ -126,7 +126,10 @@ export const SecretItem = memo(
const [isFieldFocused, setIsFieldFocused] = useToggle();
const queryClient = useQueryClient();
const canFetchSecretValue = !originalSecret.secretValueHidden && !originalSecret.isEmpty;
const canFetchSecretValue =
!originalSecret.secretValueHidden &&
!originalSecret.isEmpty &&
pendingAction !== PendingAction.Create;
const fetchSecretValueParams = {
environment,
@@ -508,13 +511,15 @@ export const SecretItem = memo(
control={control}
render={({ field }) => (
<SecretInput
isLoadingValue={isLoadingSecretValue}
isLoadingValue={isLoadingSecretValue && Boolean(secret.idOverride)}
isErrorLoadingValue={isErrorFetchingSecretValue}
key="value-overriden"
isVisible={isVisible}
isReadOnly={isReadOnly}
{...field}
onFocus={() => setIsFieldFocused.on()}
onFocus={() => {
if (secret.idOverride) setIsFieldFocused.on();
}}
onBlur={() => {
setIsFieldFocused.off();
field.onBlur();

View File

@@ -27,7 +27,7 @@ export const SecretRotationSecretRow = ({
{
environment,
secretPath,
secretKey: secret!.key,
secretKey: secret?.key ?? "",
projectId: currentProject.id
},
{