diff --git a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/DashboardSidebar.tsx b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/DashboardSidebar.tsx
index 91a0199bac7..a772133dd5f 100644
--- a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/DashboardSidebar.tsx
+++ b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/DashboardSidebar.tsx
@@ -78,7 +78,10 @@ import type {
DashboardSidebarProject,
DashboardSidebarWorkspace,
} from "./types";
-import { filterDashboardSidebarProjects } from "./utils/filterDashboardSidebarProjects";
+import {
+ filterDashboardSidebarHiddenProjects,
+ filterDashboardSidebarProjects,
+} from "./utils/filterDashboardSidebarProjects";
import {
filterDashboardSidebarProjectsByHost,
matchesHostFilter,
@@ -278,8 +281,21 @@ const DashboardSidebarContent = memo(function DashboardSidebarContent({
() => displayedGroups.map((project) => project.id),
[displayedGroups],
);
+ const displayedHiddenProjects = useMemo(
+ () =>
+ filterDashboardSidebarHiddenProjects(hiddenProjects, projectFilterQuery),
+ [hiddenProjects, projectFilterQuery],
+ );
const trimmedFilterQuery = projectFilterQuery.trim();
const isFilterActive = trimmedFilterQuery !== "" || hostFilter !== "all";
+ // A matching hidden project is a match too, so the empty state would
+ // contradict the row above it — but only while that row is on screen, and
+ // only the query narrows it, never the host filter.
+ const hasNoMatches =
+ displayedGroups.length === 0 &&
+ (trimmedFilterQuery === "" ||
+ workspacesListCollapsed ||
+ displayedHiddenProjects.length === 0);
// The sort modes only reorder rows inside a project, so the project list
// is still the manual order and stays draggable; only a filter, which
// hides projects outright, makes a project drop unsafe to commit.
@@ -527,11 +543,11 @@ const DashboardSidebarContent = memo(function DashboardSidebarContent({
)}
{!isCollapsed && !workspacesListCollapsed && (
)}
- {!isCollapsed && isFilterActive && displayedGroups.length === 0 && (
+ {!isCollapsed && isFilterActive && hasNoMatches && (
{trimmedFilterQuery !== ""
? t({
diff --git a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/utils/filterDashboardSidebarProjects/filterDashboardSidebarProjects.test.ts b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/utils/filterDashboardSidebarProjects/filterDashboardSidebarProjects.test.ts
index ffa3958f6cd..4ac460ed67c 100644
--- a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/utils/filterDashboardSidebarProjects/filterDashboardSidebarProjects.test.ts
+++ b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/utils/filterDashboardSidebarProjects/filterDashboardSidebarProjects.test.ts
@@ -4,7 +4,10 @@ import {
makeSection,
makeWorkspace,
} from "../testProjectFixtures";
-import { filterDashboardSidebarProjects } from "./filterDashboardSidebarProjects";
+import {
+ filterDashboardSidebarHiddenProjects,
+ filterDashboardSidebarProjects,
+} from "./filterDashboardSidebarProjects";
const projects = [
makeProject({
@@ -82,7 +85,9 @@ describe("filterDashboardSidebarProjects", () => {
it("trims the query before matching", () => {
expect(
- filterDashboardSidebarProjects(projects, " hero ").map((p) => p.id),
+ filterDashboardSidebarProjects(projects, " hero ").map(
+ (project) => project.id,
+ ),
).toEqual(["p-marketing"]);
});
@@ -114,3 +119,20 @@ describe("filterDashboardSidebarProjects", () => {
expect(section.section.workspaces).toHaveLength(2);
});
});
+
+describe("filterDashboardSidebarHiddenProjects", () => {
+ const hidden = [
+ { id: "h1", name: "premiere-plugin", iconUrl: null, color: null },
+ { id: "h2", name: "nango-test", iconUrl: null, color: null },
+ ];
+
+ it("keeps only the hidden projects whose name matches", () => {
+ expect(
+ filterDashboardSidebarHiddenProjects(hidden, "PREMIER").map((p) => p.id),
+ ).toEqual(["h1"]);
+ });
+
+ it("returns the list untouched without a query", () => {
+ expect(filterDashboardSidebarHiddenProjects(hidden, " ")).toBe(hidden);
+ });
+});
diff --git a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/utils/filterDashboardSidebarProjects/filterDashboardSidebarProjects.ts b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/utils/filterDashboardSidebarProjects/filterDashboardSidebarProjects.ts
index 6d2bccfbfb9..41f6ced7f46 100644
--- a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/utils/filterDashboardSidebarProjects/filterDashboardSidebarProjects.ts
+++ b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/utils/filterDashboardSidebarProjects/filterDashboardSidebarProjects.ts
@@ -1,4 +1,5 @@
import type {
+ DashboardSidebarHiddenProject,
DashboardSidebarProject,
DashboardSidebarProjectChild,
} from "../../types";
@@ -80,3 +81,17 @@ export function filterDashboardSidebarProjects(
return [{ ...project, isCollapsed: false, children }];
});
}
+
+/**
+ * The same filter over the hidden-projects restore list, so a search still
+ * finds a hidden project. Names only: a hidden project's workspaces are never
+ * built, so there is nothing else to match.
+ */
+export function filterDashboardSidebarHiddenProjects(
+ projects: DashboardSidebarHiddenProject[],
+ query: string,
+): DashboardSidebarHiddenProject[] {
+ const normalizedQuery = query.trim().toLowerCase();
+ if (normalizedQuery === "") return projects;
+ return projects.filter((project) => matches(project.name, normalizedQuery));
+}
diff --git a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/utils/filterDashboardSidebarProjects/index.ts b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/utils/filterDashboardSidebarProjects/index.ts
index 1b122941f27..5e74ccdd507 100644
--- a/apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/utils/filterDashboardSidebarProjects/index.ts
+++ b/apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/DashboardSidebar/utils/filterDashboardSidebarProjects/index.ts
@@ -1 +1,4 @@
-export { filterDashboardSidebarProjects } from "./filterDashboardSidebarProjects";
+export {
+ filterDashboardSidebarHiddenProjects,
+ filterDashboardSidebarProjects,
+} from "./filterDashboardSidebarProjects";