Skip to content

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

fix empty search states

x0322057cf8f0caa331
diff --git a/frontend/src/pages/pam/PamAccessPage/PamAccessPage.tsx b/frontend/src/pages/pam/PamAccessPage/PamAccessPage.tsx
index 4c2af16e4a..f46a3282e9 100644
--- a/frontend/src/pages/pam/PamAccessPage/PamAccessPage.tsx
+++ b/frontend/src/pages/pam/PamAccessPage/PamAccessPage.tsx
@@ -83,6 +83,7 @@ export const PamAccessPage = () => {
const filterSettled = visibleFolders.every((f) => resultCounts[f.id] !== undefined);
const filterHasMatches = visibleFolders.some((f) => (resultCounts[f.id] ?? 0) > 0);
const showNoMatches = filterActive && filterSettled && !filterHasMatches;
+ const showEmpty = !isLoadingFolders && (visibleFolders.length === 0 || showNoMatches);
return (
<>
@@ -160,7 +161,7 @@ export const PamAccessPage = () => {
</CardContent>
)}
- {!isLoadingFolders && (visibleFolders.length === 0 || showNoMatches) && (
+ {showEmpty && (
<CardContent>
<Empty>
<EmptyHeader>
@@ -177,7 +178,7 @@ export const PamAccessPage = () => {
</CardContent>
)}
- {!isLoadingFolders && visibleFolders.length > 0 && (
+ {!isLoadingFolders && !showEmpty && (
<Table>
<TableHeader>
<TableRow>
diff --git a/frontend/src/pages/pam/PamAccountsPage/PamAccountsPage.tsx b/frontend/src/pages/pam/PamAccountsPage/PamAccountsPage.tsx
index 5b6f5c6c37..d5f7d5f481 100644
--- a/frontend/src/pages/pam/PamAccountsPage/PamAccountsPage.tsx
+++ b/frontend/src/pages/pam/PamAccountsPage/PamAccountsPage.tsx
@@ -1,4 +1,4 @@
-import { useCallback, useEffect, useState } from "react";
+import { useCallback, useState } from "react";
import { Helmet } from "react-helmet";
import { useTranslation } from "react-i18next";
import { ChevronDown, FolderOpen, FolderPlus, Layers, Plus, Search } from "lucide-react";
@@ -85,10 +85,6 @@ export const PamAccountsPage = () => {
const filterActive = Boolean(query || selectedTemplateId);
const hasActiveFilters = Boolean(query || selectedFolderId || selectedTemplateId);
- useEffect(() => {
- setResultCounts({});
- }, [query, selectedTemplateId]);
-
const toggleFolder = useCallback((folderId: string) => {
setExpandedFolders((prev) => {
const next = new Set(prev);