Skip to content

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

improvement: invalidate import secrets on import mutation

Scott Wilson9134cff2697b
diff --git a/frontend/src/hooks/api/secretImports/mutation.tsx b/frontend/src/hooks/api/secretImports/mutation.tsx
index c9484ccfb3..82977b615a 100644
--- a/frontend/src/hooks/api/secretImports/mutation.tsx
+++ b/frontend/src/hooks/api/secretImports/mutation.tsx
@@ -32,6 +32,13 @@ export const useCreateSecretImport = () => {
queryClient.invalidateQueries({
queryKey: secretImportKeys.getSecretImportSecrets({ projectId, environment, path })
});
+ queryClient.invalidateQueries({
+ queryKey: secretImportKeys.getImportedFoldersAllEnvs({
+ projectId,
+ environment,
+ path: path ?? "/"
+ })
+ });
queryClient.invalidateQueries({
queryKey: dashboardKeys.getDashboardSecrets({ projectId, secretPath: path ?? "/" })
});
@@ -59,6 +66,13 @@ export const useUpdateSecretImport = () => {
queryClient.invalidateQueries({
queryKey: secretImportKeys.getSecretImportSecrets({ projectId, environment, path })
});
+ queryClient.invalidateQueries({
+ queryKey: secretImportKeys.getImportedFoldersAllEnvs({
+ projectId,
+ environment,
+ path: path ?? "/"
+ })
+ });
queryClient.invalidateQueries({
queryKey: dashboardKeys.getDashboardSecrets({ projectId, secretPath: path ?? "/" })
});
@@ -67,6 +81,8 @@ export const useUpdateSecretImport = () => {
};
export const useResyncSecretReplication = () => {
+ const queryClient = useQueryClient();
+
return useMutation<object, object, TResyncSecretReplicationDTO>({
mutationFn: async ({ environment, projectId, path, id }) => {
const { data } = await apiRequest.post(`/api/v2/secret-imports/${id}/replication-resync`, {
@@ -75,6 +91,24 @@ export const useResyncSecretReplication = () => {
projectId
});
return data;
+ },
+ onSuccess: (_, { environment, projectId, path }) => {
+ queryClient.invalidateQueries({
+ queryKey: secretImportKeys.getProjectSecretImports({ projectId, environment, path })
+ });
+ queryClient.invalidateQueries({
+ queryKey: secretImportKeys.getSecretImportSecrets({ projectId, environment, path })
+ });
+ queryClient.invalidateQueries({
+ queryKey: secretImportKeys.getImportedFoldersAllEnvs({
+ projectId,
+ environment,
+ path: path ?? "/"
+ })
+ });
+ queryClient.invalidateQueries({
+ queryKey: dashboardKeys.getDashboardSecrets({ projectId, secretPath: path ?? "/" })
+ });
}
});
};
@@ -100,6 +134,13 @@ export const useDeleteSecretImport = () => {
queryClient.invalidateQueries({
queryKey: secretImportKeys.getSecretImportSecrets({ projectId, environment, path })
});
+ queryClient.invalidateQueries({
+ queryKey: secretImportKeys.getImportedFoldersAllEnvs({
+ projectId,
+ environment,
+ path: path ?? "/"
+ })
+ });
queryClient.invalidateQueries({
queryKey: dashboardKeys.getDashboardSecrets({ projectId, secretPath: path ?? "/" })
});