From 64db9c3fae6632758f35f3d3e8089469c0ae808b Mon Sep 17 00:00:00 2001 From: "Vyctor H. Brzezowski" Date: Thu, 6 Aug 2026 20:52:09 -0300 Subject: [PATCH] fix: default homepage Plugins to Featured (#3434) Default the homepage Plugins catalog to Featured when switching from the Skills-only Trending tab, while preserving explicit valid plugin tabs and existing Skills behavior.\n\nCloses #3433 --- .../home-listing-section.claw591.test.tsx | 23 ++++++++++++++++--- src/components/HomeListingSection.tsx | 10 ++++++-- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/__tests__/home-listing-section.claw591.test.tsx b/src/__tests__/home-listing-section.claw591.test.tsx index 83729587..ed0cd57a 100644 --- a/src/__tests__/home-listing-section.claw591.test.tsx +++ b/src/__tests__/home-listing-section.claw591.test.tsx @@ -311,7 +311,9 @@ describe("HomeListingSection", () => { render(); fireEvent.click(screen.getByRole("button", { name: "Plugins" })); - expect(screen.getByRole("tab", { name: "New" }).getAttribute("aria-selected")).toBe("true"); + expect(screen.getByRole("tab", { name: "Featured" }).getAttribute("aria-selected")).toBe( + "true", + ); fireEvent.click(screen.getByRole("button", { name: "Skills" })); expect(screen.getByRole("tab", { name: "Featured" }).getAttribute("aria-selected")).toBe( @@ -326,12 +328,14 @@ describe("HomeListingSection", () => { expect(screen.getByText(/eligible activity in the current 24-hour window/i)).toBeTruthy(); }); - it("shows Featured, Official, and New for plugins but never plugin Trending", async () => { + it("defaults Plugins to Featured, preserves explicit New, and returns to Skills Trending", async () => { render(); fireEvent.click(screen.getByRole("button", { name: "Plugins" })); - expect(screen.getByRole("tab", { name: "New" }).getAttribute("aria-selected")).toBe("true"); + expect(screen.getByRole("tab", { name: "Featured" }).getAttribute("aria-selected")).toBe( + "true", + ); expect(screen.getAllByRole("tab").map((tab) => tab.textContent)).toEqual([ "Featured", "Official", @@ -339,12 +343,25 @@ describe("HomeListingSection", () => { ]); expect(screen.queryByRole("tab", { name: "Trending" })).toBeNull(); expect(screen.queryByRole("tab", { name: "Top" })).toBeNull(); + await waitFor(() => + expect(fetchPluginCatalogMock).toHaveBeenCalledWith( + expect.objectContaining({ featured: true }), + ), + ); + + fireEvent.click(screen.getByRole("tab", { name: "New" })); await waitFor(() => expect(convexQueryMock).toHaveBeenCalledWith( "packages:listPublicNewPluginsPage", expect.any(Object), ), ); + expect(screen.getByRole("tab", { name: "New" }).getAttribute("aria-selected")).toBe("true"); + + fireEvent.click(screen.getByRole("button", { name: "Skills" })); + expect(screen.getByRole("tab", { name: "Trending" }).getAttribute("aria-selected")).toBe( + "true", + ); }); it("uses the native New, Featured, and Official eligibility contracts", async () => { diff --git a/src/components/HomeListingSection.tsx b/src/components/HomeListingSection.tsx index 4d254762..957f4034 100644 --- a/src/components/HomeListingSection.tsx +++ b/src/components/HomeListingSection.tsx @@ -25,7 +25,6 @@ import { fetchPluginCatalog, type PackageListItem } from "../lib/packageApi"; import { buildPluginDetailHref } from "../lib/pluginRoutes"; import { presentationTitle } from "../lib/presentationTitle"; import { PUBLIC_CATALOG_NAME_PREVIEW_LENGTH, truncateText } from "../lib/truncateText"; -import { MarketplaceIcon } from "./MarketplaceIcon"; import { BrowseControlsDivider, BrowseCategorySelect, @@ -34,6 +33,7 @@ import { BrowseSearchTrigger, useBrowseSearchDisclosure, } from "./BrowseControls"; +import { MarketplaceIcon } from "./MarketplaceIcon"; import { OfficialBadge } from "./OfficialBadge"; import { BrowseResultsSkeleton } from "./skeletons/BrowseResultsSkeleton"; import { Badge } from "./ui/badge"; @@ -567,7 +567,13 @@ export function HomeListingSection({ initialListing = null }: HomeListingSection setKind(nextKind); setCategorySlug(undefined); setTab( - nextKind === "skills" ? (canonicalTrendingUnavailable ? "featured" : "trending") : "new", + nextKind === "skills" + ? canonicalTrendingUnavailable + ? "featured" + : "trending" + : tab === "trending" + ? "featured" + : tab, ); };