Skip to content

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

fix: resolved empty secrets on fresh env and added empty states

akhilmhdh93761f6487d1
diff --git a/backend/src/services/SecretImportService.ts b/backend/src/services/SecretImportService.ts
index ec9f9f5c48..56c6006101 100644
--- a/backend/src/services/SecretImportService.ts
+++ b/backend/src/services/SecretImportService.ts
@@ -38,6 +38,11 @@ export const getAllImportedSecrets = async (
folderId: secPathFolder.id,
secretPath: el.secretPath
});
+ } else {
+ if (el.secretPath === "/") {
+ // this happens when importing with a fresh env without any folders
+ importedSecByFid.push({ environment: el.environment, folderId: "root", secretPath: "/" });
+ }
}
});
if (importedSecByFid.length === 0) return [];
diff --git a/frontend/src/views/DashboardPage/DashboardPage.tsx b/frontend/src/views/DashboardPage/DashboardPage.tsx
index fbbb66053c..262fb2a922 100644
--- a/frontend/src/views/DashboardPage/DashboardPage.tsx
+++ b/frontend/src/views/DashboardPage/DashboardPage.tsx
@@ -676,7 +676,7 @@ export const DashboardPage = ({ envFromTop }: { envFromTop: string }) => {
const isSnapshotSecretEmtpy =
isRollbackMode && !isSnapshotSecretsLoading && !snapshotSecret?.secrets?.length;
const isSecretEmpty = (!isRollbackMode && isDashboardSecretEmpty) || isSnapshotSecretEmtpy;
- const isSecretImportEmpty = !importedSecrets?.length;
+ const isSecretImportEmpty = !secretImportCfg?.imports?.length;
const isEmptyPage = isFoldersEmpty && isSecretEmpty && isSecretImportEmpty;
if (isSecretsLoading || isEnvListLoading) {
diff --git a/frontend/src/views/DashboardPage/components/SecretImportSection/SecretImportItem.tsx b/frontend/src/views/DashboardPage/components/SecretImportSection/SecretImportItem.tsx
index 6e424fc1ab..162bdcd55a 100644
--- a/frontend/src/views/DashboardPage/components/SecretImportSection/SecretImportItem.tsx
+++ b/frontend/src/views/DashboardPage/components/SecretImportSection/SecretImportItem.tsx
@@ -1,9 +1,15 @@
import { useEffect } from "react";
import { useSortable } from "@dnd-kit/sortable";
-import { faFileImport, faFolder, faUpDown, faXmark } from "@fortawesome/free-solid-svg-icons";
+import {
+ faFileImport,
+ faFolder,
+ faKey,
+ faUpDown,
+ faXmark
+} from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { IconButton, TableContainer, Tooltip } from "@app/components/v2";
+import { EmptyState, IconButton, TableContainer, Tooltip } from "@app/components/v2";
import { useWorkspace } from "@app/context";
import { useToggle } from "@app/hooks/useToggle";
@@ -119,6 +125,13 @@ export const SecretImportItem = ({
</tr>
</thead>
<tbody>
+ {importedSecrets?.length === 0 && (
+ <tr>
+ <td colSpan={3}>
+ <EmptyState title="No secrets found" icon={faKey} />
+ </td>
+ </tr>
+ )}
{importedSecrets.map(({ key, value, overriden }, index) => (
<tr key={`${importedEnv}-${importedSecPath}-${key}-${index + 1}`}>
<td className="h-10" style={{ padding: "0.25rem 1rem" }}>