Skip to content

Commit 244d67f

Browse files
authored
fix(dashboard): always load marketplace skills even without search keyword (librefang#2243)
searchQuery was gated on !!searchKeyword, so opening the marketplace tab with no input disabled the query and showed an empty state. The queryFn already had a '|| "python"' fallback that never executed. - Remove the searchKeyword guard from enabled; query now always runs in marketplace mode - Extract effectiveKeyword so queryKey matches the actual request, fixing stale-cache mismatches - Show a helpful description on empty state: 'Browse is temporarily unavailable. Try searching above.' when browse results are empty (ClawHub /api/v1/skills returns empty server-side, fixes librefang#2230)
1 parent 48c7c40 commit 244d67f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

crates/librefang-api/dashboard/src/pages/SkillsPage.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -368,12 +368,14 @@ export function SkillsPage() {
368368
// Queries
369369
const skillsQuery = useQuery({ queryKey: ["skills", "list"], queryFn: listSkills, refetchInterval: REFRESH_MS });
370370

371-
// ClawHub search API
371+
// ClawHub search API — always runs in marketplace mode; falls back to "python"
372+
// when no keyword so the tab shows results instead of an empty state.
373+
const effectiveKeyword = searchKeyword || "python";
372374
const searchQuery = useQuery({
373-
queryKey: ["clawhub", "search", searchKeyword],
374-
queryFn: () => clawhubSearch(searchKeyword || "python"),
375+
queryKey: ["clawhub", "search", effectiveKeyword],
376+
queryFn: () => clawhubSearch(effectiveKeyword),
375377
staleTime: 60000,
376-
enabled: viewMode === "marketplace" && !!searchKeyword,
378+
enabled: viewMode === "marketplace",
377379
});
378380

379381
// Skillhub queries — category selection also drives search
@@ -735,7 +737,7 @@ export function SkillsPage() {
735737
) : marketplaceError ? (
736738
<EmptyState title={t("skills.load_error")} description={marketplaceError.message || t("common.error")} icon={<Search className="h-6 w-6" />} />
737739
) : filteredMarketplace.length === 0 ? (
738-
<EmptyState title={t("skills.no_results")} icon={<Search className="h-6 w-6" />} />
740+
<EmptyState title={t("skills.no_results")} description={search ? t("skills.try_different_search", { defaultValue: "Try a different search term." }) : t("skills.browse_unavailable", { defaultValue: "Browse is temporarily unavailable. Try searching above." })} icon={<Search className="h-6 w-6" />} />
739741
) : (
740742
<div className="overflow-y-auto max-h-[600px] pr-1">
741743
<div className="grid gap-2 sm:gap-4 md:grid-cols-2 xl:grid-cols-3">

0 commit comments

Comments
 (0)