Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
fix(ui): invalidate secret list variants after mutations (#8336)
Andrew Huange008b8c4a15f
diff --git a/frontend/src/components/proxied-services/forms/CreateSecretModal.tsx b/frontend/src/components/proxied-services/forms/CreateSecretModal.tsxindex a3ac53b772..344f154485 100644--- a/frontend/src/components/proxied-services/forms/CreateSecretModal.tsx+++ b/frontend/src/components/proxied-services/forms/CreateSecretModal.tsx@@ -82,8 +82,6 @@ export const CreateSecretModal = ({type: SecretType.Shared});- // the picker reads secrets with viewSecretValue: true, which the mutation's own invalidation- // does not matchawait queryClient.invalidateQueries({queryKey: secretKeys.getProjectSecret({projectId,diff --git a/frontend/src/hooks/api/secrets/mutations.tsx b/frontend/src/hooks/api/secrets/mutations.tsxindex 30f165a1bd..0975d44bb1 100644--- a/frontend/src/hooks/api/secrets/mutations.tsx+++ b/frontend/src/hooks/api/secrets/mutations.tsx@@ -387,7 +387,16 @@ export const useMoveSecrets = ({return data;},- onSuccess: (_, { projectId, sourceEnvironment, sourceSecretPath, destinationSecretPath }) => {+ onSuccess: (+ _,+ {+ projectId,+ sourceEnvironment,+ sourceSecretPath,+ destinationEnvironment,+ destinationSecretPath+ }+ ) => {queryClient.invalidateQueries({queryKey: dashboardKeys.getDashboardSecrets({projectId,@@ -409,6 +418,18 @@ export const useMoveSecrets = ({secretPath: sourceSecretPath})});+ if (+ destinationEnvironment !== sourceEnvironment ||+ destinationSecretPath !== sourceSecretPath+ ) {+ queryClient.invalidateQueries({+ queryKey: secretKeys.getProjectSecret({+ projectId,+ environment: destinationEnvironment,+ secretPath: destinationSecretPath+ })+ });+ }queryClient.invalidateQueries({queryKey: commitKeys.count({projectId,diff --git a/frontend/src/hooks/api/secrets/queries.tsx b/frontend/src/hooks/api/secrets/queries.tsxindex 49b79884c5..dcd82a90f1 100644--- a/frontend/src/hooks/api/secrets/queries.tsx+++ b/frontend/src/hooks/api/secrets/queries.tsx@@ -38,7 +38,15 @@ export const secretKeys = {secretPath,viewSecretValue}: TGetProjectSecretsKey) =>- [{ projectId, environment, secretPath, viewSecretValue }, "secrets"] as const,+ [+ {+ projectId,+ environment,+ secretPath,+ ...(viewSecretValue === undefined ? {} : { viewSecretValue })+ },+ "secrets"+ ] as const,getProjectSecretExportPreflight: ({projectId,environment,