Skip to content

feat: add unified search to trends, posts, users#514

Merged
CedrikNikita merged 1 commit intodevelopfrom
feature/add-search-feature-in-explorer
Mar 31, 2026
Merged

feat: add unified search to trends, posts, users#514
CedrikNikita merged 1 commit intodevelopfrom
feature/add-search-feature-in-explorer

Conversation

@CedrikNikita
Copy link
Copy Markdown
Collaborator

@CedrikNikita CedrikNikita commented Mar 27, 2026

Note

Medium Risk
Touches a large, user-facing view with multiple new queries, conditional rendering paths, and navigation behaviors; main risk is regressions in trends browsing/search UX and API query wiring rather than security/data integrity.

Overview
Adds a unified search experience to the Trends TokenList view: a single search input queries tokens, users, and posts, hides the normal tabs while searching, and shows sectioned results with smart ordering (including address exact-match boosting), per-section “View all/Show less” expansion, and error/loading states.

Introduces new trendsSearch API helpers to fetch preview results (3 per section), full section results (24), and fallback content (trending tokens, popular posts, top traders) with consistent pagination normalization.

Updates the non-search view to support three tabs (Tokens, Users, Posts) where Users shows top traders and Posts shows popular posts, and adds Vitest coverage for both the new API helpers and the updated TokenList behavior.

Written by Cursor Bugbot for commit b41bc2e. This will update automatically on new commits. Configure here.

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 27, 2026

Deploy Preview for fancy-gelato-7cdad5 ready!

Name Link
🔨 Latest commit b41bc2e
🔍 Latest deploy log https://app.netlify.com/projects/fancy-gelato-7cdad5/deploys/69cba79f436bfa000974e34f
😎 Deploy Preview https://deploy-preview-514--fancy-gelato-7cdad5.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@CedrikNikita CedrikNikita force-pushed the feature/add-search-feature-in-explorer branch from eacfd69 to cdbb4c6 Compare March 31, 2026 06:16
@CedrikNikita CedrikNikita marked this pull request as ready for review March 31, 2026 06:16
@CedrikNikita CedrikNikita force-pushed the feature/add-search-feature-in-explorer branch from cdbb4c6 to ed227b8 Compare March 31, 2026 09:42
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

Bugbot Autofix prepared fixes for both issues found in the latest run.

  • ✅ Fixed: Incorrect type assertion on awaited value casts as Promise
    • I fixed the precedence issue by parenthesizing the as Promise<...> assertions so the cast applies before await in all flagged calls.
  • ✅ Fixed: Fallback query keys unnecessarily include search term
    • I removed searchTerm from fallback query keys so identical fallback requests share one React Query cache entry.

Create PR

Or push these changes by commenting:

@cursor push 54a00b9e8f
Preview (54a00b9e8f)
diff --git a/src/features/trending/api/trendsSearch.ts b/src/features/trending/api/trendsSearch.ts
--- a/src/features/trending/api/trendsSearch.ts
+++ b/src/features/trending/api/trendsSearch.ts
@@ -141,23 +141,23 @@
 
   switch (tab) {
     case 'tokens':
-      return normalizeSection<TrendTokenItem>(await SuperheroApi.listTokens({
+      return normalizeSection<TrendTokenItem>(await (SuperheroApi.listTokens({
         search: term,
         limit: SEARCH_FULL_LIMIT,
         page: 1,
         orderBy: 'market_cap',
         orderDirection: 'DESC',
-      }) as Promise<PaginatedApiResponse<TrendTokenItem>>);
+      }) as Promise<PaginatedApiResponse<TrendTokenItem>>));
     case 'users':
       return normalizeSection<TrendUserItem>(await fetchAccountSearch(SEARCH_FULL_LIMIT, term));
     case 'posts':
-      return normalizeSection<TrendPostItem>(await SuperheroApi.listPosts({
+      return normalizeSection<TrendPostItem>(await (SuperheroApi.listPosts({
         search: term,
         limit: SEARCH_FULL_LIMIT,
         page: 1,
         orderBy: 'created_at',
         orderDirection: 'DESC',
-      }) as Promise<PaginatedApiResponse<TrendPostItem>>);
+      }) as Promise<PaginatedApiResponse<TrendPostItem>>));
     default: {
       const exhaustive: never = tab;
       throw new Error(`Unknown search tab: ${exhaustive}`);
@@ -166,20 +166,20 @@
 }
 
 export async function fetchTrendingTokens(limit: number = DEFAULT_TAB_LIMIT) {
-  return normalizeSection<TrendTokenItem>(await SuperheroApi.listTokens({
+  return normalizeSection<TrendTokenItem>(await (SuperheroApi.listTokens({
     limit,
     page: 1,
     orderBy: 'trending_score',
     orderDirection: 'DESC',
-  }) as Promise<PaginatedApiResponse<TrendTokenItem>>);
+  }) as Promise<PaginatedApiResponse<TrendTokenItem>>));
 }
 
 export async function fetchPopularPosts(limit: number = DEFAULT_TAB_LIMIT) {
-  return normalizeSection<TrendPostItem>(await SuperheroApi.listPopularPosts({
+  return normalizeSection<TrendPostItem>(await (SuperheroApi.listPopularPosts({
     window: 'all',
     limit,
     page: 1,
-  }) as Promise<PaginatedApiResponse<TrendPostItem>>);
+  }) as Promise<PaginatedApiResponse<TrendPostItem>>));
 }
 
 export async function fetchTopTraders(limit: number = DEFAULT_TAB_LIMIT) {

diff --git a/src/features/trending/views/TokenList.tsx b/src/features/trending/views/TokenList.tsx
--- a/src/features/trending/views/TokenList.tsx
+++ b/src/features/trending/views/TokenList.tsx
@@ -381,7 +381,7 @@
     enabled: hasSearch
       && searchPreviewQuery.isSuccess
       && searchPreviewQuery.data.tokens.items.length === 0,
-    queryKey: ['trends', 'fallback', 'tokens', searchTerm],
+    queryKey: ['trends', 'fallback', 'tokens'],
     queryFn: () => fetchTrendingTokens(FALLBACK_LIMIT),
     staleTime: 60 * 1000,
   });
@@ -390,7 +390,7 @@
     enabled: hasSearch
       && searchPreviewQuery.isSuccess
       && searchPreviewQuery.data.users.items.length === 0,
-    queryKey: ['trends', 'fallback', 'users', searchTerm],
+    queryKey: ['trends', 'fallback', 'users'],
     queryFn: () => fetchTopTraders(FALLBACK_LIMIT),
     staleTime: 60 * 1000,
   });
@@ -399,7 +399,7 @@
     enabled: hasSearch
       && searchPreviewQuery.isSuccess
       && searchPreviewQuery.data.posts.items.length === 0,
-    queryKey: ['trends', 'fallback', 'posts', searchTerm],
+    queryKey: ['trends', 'fallback', 'posts'],
     queryFn: () => fetchPopularPosts(FALLBACK_LIMIT),
     staleTime: 60 * 1000,
   });

This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

@CedrikNikita CedrikNikita force-pushed the feature/add-search-feature-in-explorer branch from ed227b8 to b41bc2e Compare March 31, 2026 10:53
@CedrikNikita CedrikNikita merged commit bebeaee into develop Mar 31, 2026
7 checks passed
@CedrikNikita CedrikNikita deleted the feature/add-search-feature-in-explorer branch April 1, 2026 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants