From 999ce3fec60e61fe27be43f42cabda8a3a576417 Mon Sep 17 00:00:00 2001 From: Scott Wilson Date: Thu, 18 Sep 2025 12:09:28 -0700 Subject: [PATCH] improvements: resolve more commit state issues form value reveal change --- frontend/src/hooks/api/secrets/queries.tsx | 8 +------- .../SecretOverviewRotationSecretRow.tsx | 2 +- .../SecretOverviewTableRow/SecretEditRow.tsx | 2 +- .../components/CommitForm/CommitForm.tsx | 2 +- .../components/SecretListView/SecretItem.tsx | 11 ++++++++--- .../SecretRotationSecretRow.tsx | 2 +- 6 files changed, 13 insertions(+), 14 deletions(-) diff --git a/frontend/src/hooks/api/secrets/queries.tsx b/frontend/src/hooks/api/secrets/queries.tsx index e3cbf7f0e..4eb2ba22f 100644 --- a/frontend/src/hooks/api/secrets/queries.tsx +++ b/frontend/src/hooks/api/secrets/queries.tsx @@ -272,13 +272,7 @@ export const useGetSecretVersion = (dto: GetSecretVersionsDTO) => export const fetchSecretVersionValue = async (secretId: string, version: number) => { const { data } = await apiRequest.get( - `/api/v1/dashboard/secret-versions/${secretId}/value/${version}`, - { - params: { - secretId, - version - } - } + `/api/v1/dashboard/secret-versions/${secretId}/value/${version}` ); return data.value; }; diff --git a/frontend/src/pages/secret-manager/OverviewPage/components/SecretOverviewSecretRotationRow/SecretOverviewRotationSecretRow.tsx b/frontend/src/pages/secret-manager/OverviewPage/components/SecretOverviewSecretRotationRow/SecretOverviewRotationSecretRow.tsx index e8df569b9..f8efdf17e 100644 --- a/frontend/src/pages/secret-manager/OverviewPage/components/SecretOverviewSecretRotationRow/SecretOverviewRotationSecretRow.tsx +++ b/frontend/src/pages/secret-manager/OverviewPage/components/SecretOverviewSecretRotationRow/SecretOverviewRotationSecretRow.tsx @@ -29,7 +29,7 @@ export const SecretOverviewRotationSecretRow = ({ const { data: secretValueData, isError } = useGetSecretValue( { - secretKey: secret!.key, + secretKey: secret?.key ?? "", environment, secretPath, projectId: currentProject.id diff --git a/frontend/src/pages/secret-manager/OverviewPage/components/SecretOverviewTableRow/SecretEditRow.tsx b/frontend/src/pages/secret-manager/OverviewPage/components/SecretOverviewTableRow/SecretEditRow.tsx index be914024e..9046f2ea7 100644 --- a/frontend/src/pages/secret-manager/OverviewPage/components/SecretOverviewTableRow/SecretEditRow.tsx +++ b/frontend/src/pages/secret-manager/OverviewPage/components/SecretOverviewTableRow/SecretEditRow.tsx @@ -117,7 +117,7 @@ export const SecretEditRow = ({ ? { environment: importedSecret.environment, secretPath: importedSecret.secretPath, - secretKey: importedSecret.secret!.key, + secretKey: importedSecret.secret?.key ?? "", projectId: currentProject.id } : { diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/CommitForm/CommitForm.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/CommitForm/CommitForm.tsx index ac72adf43..59cceb9bb 100644 --- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/CommitForm/CommitForm.tsx +++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/CommitForm/CommitForm.tsx @@ -143,7 +143,7 @@ const RenderSecretChanges = ({ onDiscard, change }: RenderResourceProps) => { { version: 1, // placeholder, not used secretKey, - secretValue + secretValue: secretValue || undefined } ] }} diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretItem.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretItem.tsx index 7b3ac9738..e933d1b5e 100644 --- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretItem.tsx +++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretListView/SecretItem.tsx @@ -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 }) => ( setIsFieldFocused.on()} + onFocus={() => { + if (secret.idOverride) setIsFieldFocused.on(); + }} onBlur={() => { setIsFieldFocused.off(); field.onBlur(); diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretRotationListView/SecretRotationSecretRow.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretRotationListView/SecretRotationSecretRow.tsx index cf89c3296..e8b7788af 100644 --- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretRotationListView/SecretRotationSecretRow.tsx +++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/SecretRotationListView/SecretRotationSecretRow.tsx @@ -27,7 +27,7 @@ export const SecretRotationSecretRow = ({ { environment, secretPath, - secretKey: secret!.key, + secretKey: secret?.key ?? "", projectId: currentProject.id }, {