Skip to content

Conversation

@joaquim-verges
Copy link
Member

@joaquim-verges joaquim-verges commented Jul 24, 2025

<!--

## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes"

[Portal] Feature: Add pagination and search to AllSupportedWallets

If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000):

## Notes for the reviewer

- Converted `AllSupportedWallets.tsx` from a server component to a client component to enable state management for search and pagination.
- Implemented search by wallet name and ID (case-insensitive).
- Added pagination with 20 items per page, including page number controls.
- Includes loading, empty, and results count states for improved UX.

## How to test

1. Navigate to a page that renders the `AllSupportedWallets` component (e.g., a documentation page listing supported wallets).
2. Verify the search input at the top filters wallets by name and ID as you type.
3. Test the pagination controls (Previous, Next, and page number buttons) at the bottom of the table.
4. Check the results count and page information displayed.
5. Confirm loading and empty states are displayed correctly when applicable.

-->

Slack ThreadOpen in WebOpen in Cursor


PR-Codex overview

This PR introduces a new component, AllSupportedWallets, that utilizes react-query for fetching and displaying a paginated list of wallets. It includes a search feature, improved loading states, and pagination controls.

Detailed summary

  • Added react-query for data fetching.
  • Created AllSupportedWallets and AllSupportedWalletsContent components.
  • Implemented a search input for filtering wallets.
  • Added pagination functionality with previous/next buttons.
  • Updated the WalletImage function to use react-query for fetching wallet images.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Summary by CodeRabbit

  • New Features

    • Introduced search functionality to filter wallets by name or ID.
    • Added pagination controls, displaying 20 wallets per page with navigation buttons.
    • Displayed a loading indicator while fetching wallet data.
    • Shown wallet count and a message when no wallets match the search.
    • Wallet images now load asynchronously with caching and show placeholders while loading.
  • Refactor

    • Improved the wallet list to be interactive and dynamic, enhancing user experience with client-side updates and caching.

@joaquim-verges joaquim-verges requested review from a team as code owners July 24, 2025 21:59
@changeset-bot
Copy link

changeset-bot bot commented Jul 24, 2025

⚠️ No Changeset found

Latest commit: f0424ad

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link

vercel bot commented Jul 24, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs-v2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 25, 2025 9:02am
4 Skipped Deployments
Name Status Preview Comments Updated (UTC)
nebula ⬜️ Skipped (Inspect) Jul 25, 2025 9:02am
thirdweb_playground ⬜️ Skipped (Inspect) Jul 25, 2025 9:02am
thirdweb-www ⬜️ Skipped (Inspect) Jul 25, 2025 9:02am
wallet-ui ⬜️ Skipped (Inspect) Jul 25, 2025 9:02am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 24, 2025

Walkthrough

The AllSupportedWallets component was refactored from an async server component to a fully client-side React component using React Query for asynchronous data fetching and caching. It now supports wallet list fetching, individual wallet image fetching with caching, search filtering, pagination, and manages loading and empty states with updated UI rendering.

Changes

File(s) Change Summary
apps/portal/src/components/others/AllSupportedWallets.tsx Refactored from async server component to client-side React component; added React Query for wallet list and image fetching with caching; implemented search, filtering, pagination, loading and empty states; updated rendering logic and UI structure.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant AllSupportedWallets (Client)
    participant WalletAPI

    User->>AllSupportedWallets (Client): Mount component
    AllSupportedWallets (Client)->>WalletAPI: Fetch wallet list (useQuery)
    WalletAPI-->>AllSupportedWallets (Client): Return wallet list
    AllSupportedWallets (Client)->>AllSupportedWallets (Client): Store wallets in state
    User->>AllSupportedWallets (Client): Enter search query
    AllSupportedWallets (Client)->>AllSupportedWallets (Client): Filter wallets, reset pagination
    User->>AllSupportedWallets (Client): Change page
    AllSupportedWallets (Client)->>AllSupportedWallets (Client): Update current page
    AllSupportedWallets (Client)->>WalletAPI: Fetch wallet image (useQuery)
    WalletAPI-->>AllSupportedWallets (Client): Return wallet image
    AllSupportedWallets (Client)-->>User: Display filtered, paginated wallets with images
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • TEAM-0000: Entity not found: Issue - Could not find referenced Issue.

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 90dea67 and f0424ad.

📒 Files selected for processing (1)
  • apps/portal/src/components/others/AllSupportedWallets.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/portal/src/components/others/AllSupportedWallets.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: Unit Tests
  • GitHub Check: Lint Packages
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: Build Packages
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: Size
  • GitHub Check: Analyze (javascript)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch cursor/add-search-and-pagination-to-wallet-list-54e0

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the Portal Involves changes to the Portal (docs) codebase. label Jul 24, 2025
@graphite-app
Copy link
Contributor

graphite-app bot commented Jul 24, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge-queue - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

@codecov
Copy link

codecov bot commented Jul 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 56.26%. Comparing base (48361f9) to head (f0424ad).
Report is 10 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7703      +/-   ##
==========================================
- Coverage   56.31%   56.26%   -0.06%     
==========================================
  Files         908      908              
  Lines       58177    58177              
  Branches     4207     4208       +1     
==========================================
- Hits        32765    32731      -34     
- Misses      25302    25337      +35     
+ Partials      110      109       -1     
Flag Coverage Δ
packages 56.26% <ø> (-0.06%) ⬇️

see 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Contributor

github-actions bot commented Jul 24, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 63.33 KB (0%) 1.3 s (0%) 248 ms (+110.43% 🔺) 1.6 s
thirdweb (cjs) 353.15 KB (0%) 7.1 s (0%) 1.1 s (+9.25% 🔺) 8.1 s
thirdweb (minimal + tree-shaking) 5.7 KB (0%) 114 ms (0%) 101 ms (+1103.25% 🔺) 215 ms
thirdweb/chains (tree-shaking) 526 B (0%) 11 ms (0%) 27 ms (+513.77% 🔺) 38 ms
thirdweb/react (minimal + tree-shaking) 19.18 KB (0%) 384 ms (0%) 79 ms (+199.62% 🔺) 463 ms

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
apps/portal/src/components/others/AllSupportedWallets.tsx (1)

141-141: Consider improving type safety.

The type assertion as WalletId could be avoided if WalletInfo.id was typed as WalletId instead of string. This would provide better compile-time type safety.

interface WalletInfo {
-  id: string;
+  id: WalletId;
  name: string;
}

Then remove the type assertion:

-<WalletImage id={wallet.id as WalletId} />
+<WalletImage id={wallet.id} />
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 75bf091 and 2c7ae5c.

📒 Files selected for processing (1)
  • apps/portal/src/components/others/AllSupportedWallets.tsx (2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (CLAUDE.md)

**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity
Re-use shared types from @/types or local types.ts barrels
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Choose composition over inheritance; leverage utility types (Partial, Pick, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose

Files:

  • apps/portal/src/components/others/AllSupportedWallets.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit Inference Engine (CLAUDE.md)

Load heavy dependencies inside async paths to keep initial bundle lean (lazy loading)

Files:

  • apps/portal/src/components/others/AllSupportedWallets.tsx
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to packages/thirdweb/src/wallets/** : EIP-1193, EIP-5792, EIP-7702 standard support in wallet modules
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Interactive UI that relies on hooks (`useState`, `useEffect`, React Query, wallet hooks).
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to packages/thirdweb/src/wallets/** : Support for in-app wallets (social/email login)
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to packages/thirdweb/src/wallets/** : Unified `Wallet` and `Account` interfaces in wallet architecture
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Surface breaking changes prominently in PR descriptions
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*.{tsx,jsx} : Local state or effects live inside; data fetching happens in hooks.
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Use React Query (`@tanstack/react-query`) for all client data fetching.
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Pages requiring fast transitions where data is prefetched on the client.
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*.{tsx,jsx} : Keep components pure; fetch data outside (server component or hook) and pass it down via props.
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Anything that consumes hooks from `@tanstack/react-query` or thirdweb SDKs.
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Components that listen to user events, animations or live updates.
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to apps/{dashboard,playground-web}/**/*.{ts,tsx} : Wrap client-side data fetching calls in React Query (`@tanstack/react-query`)
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Create light wrappers (e.g. `fetchJson`) that automatically attach the JWT from cookies/session when calling internal API routes.
apps/portal/src/components/others/AllSupportedWallets.tsx (16)

Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Interactive UI that relies on hooks (useState, useEffect, React Query, wallet hooks).

Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to packages/thirdweb/src/wallets/** : Unified Wallet and Account interfaces in wallet architecture

Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to packages/thirdweb/src/wallets/** : EIP-1193, EIP-5792, EIP-7702 standard support in wallet modules

Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to packages/thirdweb/src/wallets/** : Support for in-app wallets (social/email login)

Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Pages requiring fast transitions where data is prefetched on the client.

Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to test/src/test-wallets.ts : Predefined test accounts are in test/src/test-wallets.ts

Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*.{tsx,jsx} : Local state or effects live inside; data fetching happens in hooks.

Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Anything that consumes hooks from @tanstack/react-query or thirdweb SDKs.

Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Use React Query (@tanstack/react-query) for all client data fetching.

Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*.{tsx,jsx} : Keep components pure; fetch data outside (server component or hook) and pass it down via props.

Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : When you need access to browser APIs (localStorage, window, IntersectionObserver etc.).

Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/components/*.client.tsx : Client components must start with 'use client'; before imports.

Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Components that listen to user events, animations or live updates.

Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to apps/{dashboard,playground-web}/**/*.{ts,tsx} : Client Components (browser): Begin files with 'use client';

Learnt from: MananTank
PR: #7227
File: apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/modules/components/OpenEditionMetadata.tsx:26-26
Timestamp: 2025-05-30T17:14:25.332Z
Learning: The ModuleCardUIProps interface already includes a client prop of type ThirdwebClient, so when components use Omit<ModuleCardUIProps, "children" | "updateButton">, they inherit the client prop without needing to add it explicitly.

Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Create light wrappers (e.g. fetchJson) that automatically attach the JWT from cookies/session when calling internal API routes.

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Size
  • GitHub Check: Unit Tests
  • GitHub Check: Build Packages
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (7)
apps/portal/src/components/others/AllSupportedWallets.tsx (7)

1-14: LGTM! Client component setup is correct.

The conversion to a client component with appropriate imports for state management and UI components aligns with the learnings about client components requiring the 'use client' directive and using hooks for interactive UI.


23-28: Good type definition and constant naming.

The WalletInfo interface and ITEMS_PER_PAGE constant are well-defined and follow TypeScript best practices.


57-66: Excellent use of useMemo for search filtering.

The filtering logic is well-implemented with proper memoization and case-insensitive search across both wallet name and ID.


68-88: Well-implemented pagination logic.

The pagination calculations are correct, and the UX consideration to reset to the first page when search changes is a nice touch. The boundary checks in the navigation handlers prevent invalid page states.


90-96: Loading state handling looks good.

The loading UI provides clear feedback. Note that if you adopt React Query as suggested earlier, you'd use isLoading instead of the loading state.


179-203: Sophisticated pagination controls with good UX.

The page number calculation logic elegantly handles showing 5 page buttons while keeping the current page centered when possible. The implementation correctly handles edge cases near the start and end of the page range.


36-55: Use React Query for data fetching instead of useEffect.

According to the learnings, client components should use React Query (@tanstack/react-query) for all data fetching. The current implementation uses a plain useEffect which doesn't provide features like caching, background refetching, and error states.

Additionally, consider showing an error state to users instead of only logging to console.

Here's a suggested refactor using React Query:

-  const [wallets, setWallets] = useState<WalletInfo[]>([]);
-  const [loading, setLoading] = useState(true);
+  const { data: wallets = [], isLoading, error } = useQuery({
+    queryKey: ['wallets'],
+    queryFn: async () => {
+      const allWallets = await getAllWalletsList();
+      return allWallets
+        .filter((w) => !(w.id in specialWallets))
+        .map((w) => ({
+          id: w.id,
+          name: w.name,
+        }));
+    },
+  });

-  useEffect(() => {
-    async function loadWallets() {
-      try {
-        const allWallets = await getAllWalletsList();
-        const filteredWallets = allWallets
-          .filter((w) => !(w.id in specialWallets))
-          .map((w) => ({
-            id: w.id,
-            name: w.name,
-          }));
-        setWallets(filteredWallets);
-      } catch (error) {
-        console.error("Failed to load wallets:", error);
-      } finally {
-        setLoading(false);
-      }
-    }
-
-    loadWallets();
-  }, []);

Don't forget to wrap your component tree with QueryClientProvider if not already done.

⛔ Skipped due to learnings
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Use React Query (`@tanstack/react-query`) for all client data fetching.
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Interactive UI that relies on hooks (`useState`, `useEffect`, React Query, wallet hooks).
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to apps/{dashboard,playground-web}/**/*.{ts,tsx} : Wrap client-side data fetching calls in React Query (`@tanstack/react-query`)
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*.{tsx,jsx} : Local state or effects live inside; data fetching happens in hooks.
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Anything that consumes hooks from `@tanstack/react-query` or thirdweb SDKs.
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*.{tsx,jsx} : Keep components pure; fetch data outside (server component or hook) and pass it down via props.
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to apps/{dashboard,playground-web}/**/*.{ts,tsx} : Use descriptive, stable `queryKeys` for React Query cache hits
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Keep `queryKey` stable and descriptive for cache hits.
Learnt from: CR
PR: thirdweb-dev/js#0
File: .cursor/rules/dashboard.mdc:0-0
Timestamp: 2025-07-18T19:20:32.530Z
Learning: Applies to dashboard/**/*client.tsx : Pages requiring fast transitions where data is prefetched on the client.
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to apps/{dashboard,playground-web}/**/*.{ts,tsx} : Configure `staleTime`/`cacheTime` in React Query based on freshness (default ≥ 60s)
Learnt from: CR
PR: thirdweb-dev/js#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-18T19:19:55.613Z
Learning: Applies to test/src/test-wallets.ts : Predefined test accounts are in `test/src/test-wallets.ts`

@vercel vercel bot temporarily deployed to Preview – thirdweb_playground July 25, 2025 08:20 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui July 25, 2025 08:20 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb-www July 25, 2025 08:20 Inactive
@vercel vercel bot temporarily deployed to Preview – nebula July 25, 2025 08:20 Inactive
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🧹 Nitpick comments (3)
apps/portal/src/components/others/AllSupportedWallets.tsx (3)

185-209: Extract complex pagination logic into a helper function.

The page number calculation logic is complex and reduces readability. Consider extracting it for better maintainability.

Add this helper function before the component:

function getPageNumbers(currentPage: number, totalPages: number): number[] {
  if (totalPages <= 5) {
    return Array.from({ length: totalPages }, (_, i) => i + 1);
  }
  
  if (currentPage <= 3) {
    return [1, 2, 3, 4, 5];
  }
  
  if (currentPage >= totalPages - 2) {
    return Array.from({ length: 5 }, (_, i) => totalPages - 4 + i);
  }
  
  return Array.from({ length: 5 }, (_, i) => currentPage - 2 + i);
}

Then simplify the render logic:

-            {Array.from({ length: Math.min(5, totalPages) }, (_, i) => {
-              let pageNumber: number;
-
-              if (totalPages <= 5) {
-                pageNumber = i + 1;
-              } else if (currentPage <= 3) {
-                pageNumber = i + 1;
-              } else if (currentPage >= totalPages - 2) {
-                pageNumber = totalPages - 4 + i;
-              } else {
-                pageNumber = currentPage - 2 + i;
-              }
-
-              return (
+            {getPageNumbers(currentPage, totalPages).map((pageNumber) => (
                <Button
                  key={pageNumber}
                  variant={currentPage === pageNumber ? "default" : "outline"}
                  size="sm"
                  onClick={() => handlePageClick(pageNumber)}
                  className="min-w-[32px]"
                >
                  {pageNumber}
                </Button>
-              );
-            })}
+            ))}

173-182: Add accessibility attributes to pagination buttons.

The pagination buttons lack proper accessibility attributes for screen readers.

             <Button
               variant="outline"
               size="sm"
               onClick={handlePreviousPage}
               disabled={currentPage === 1}
+              aria-label="Go to previous page"
             >
               <ChevronLeftIcon className="size-4" />
               Previous
             </Button>
             <Button
               variant="outline"
               size="sm"
               onClick={handleNextPage}
               disabled={currentPage === totalPages}
+              aria-label="Go to next page"
             >
               Next
               <ChevronRightIcon className="size-4" />
             </Button>

Also applies to: 212-221


231-231: Document the boolean parameter in getWalletInfo call.

The true parameter passed to getWalletInfo is not self-documenting. Consider adding a comment to clarify its purpose.

-    queryFn: () => getWalletInfo(props.id, true),
+    queryFn: () => getWalletInfo(props.id, true /* includeImage */),
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2c7ae5c and 90dea67.

📒 Files selected for processing (1)
  • apps/portal/src/components/others/AllSupportedWallets.tsx (2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (CLAUDE.md)

**/*.{ts,tsx}: Write idiomatic TypeScript with explicit function declarations and return types
Limit each file to one stateless, single-responsibility function for clarity
Re-use shared types from @/types or local types.ts barrels
Prefer type aliases over interface except for nominal shapes
Avoid any and unknown unless unavoidable; narrow generics when possible
Choose composition over inheritance; leverage utility types (Partial, Pick, etc.)
Comment only ambiguous logic; avoid restating TypeScript in prose

Files:

  • apps/portal/src/components/others/AllSupportedWallets.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit Inference Engine (CLAUDE.md)

Load heavy dependencies inside async paths to keep initial bundle lean (lazy loading)

Files:

  • apps/portal/src/components/others/AllSupportedWallets.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: Unit Tests
  • GitHub Check: Analyze (javascript)

const wallets = await getAllWalletsList();
const ITEMS_PER_PAGE = 20;

const queryClient = new QueryClient();
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Move QueryClient instantiation inside the component to avoid SSR issues.

Creating QueryClient at the module level can cause hydration mismatches and memory leaks in SSR environments. Initialize it inside the component or use a factory function.

Apply this diff:

-const queryClient = new QueryClient();
-
 export function AllSupportedWallets() {
+  const [queryClient] = useState(() => new QueryClient());
   return (

Also add the missing import:

-import { useMemo, useState } from "react";
+import { useMemo, useState } from "react";

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In apps/portal/src/components/others/AllSupportedWallets.tsx at line 31, move
the instantiation of QueryClient from the module level into the component
function to prevent SSR hydration mismatches and memory leaks. Also, add the
missing import statement for QueryClient from the appropriate library at the top
of the file.

Comment on lines +33 to +39
export function AllSupportedWallets() {
return (
<QueryClientProvider client={queryClient}>
<AllSupportedWalletsContent />
</QueryClientProvider>
);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add explicit return type to the component function.

Per the coding guidelines, TypeScript functions should have explicit return types.

-export function AllSupportedWallets() {
+export function AllSupportedWallets(): JSX.Element {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export function AllSupportedWallets() {
return (
<QueryClientProvider client={queryClient}>
<AllSupportedWalletsContent />
</QueryClientProvider>
);
}
export function AllSupportedWallets(): JSX.Element {
return (
<QueryClientProvider client={queryClient}>
<AllSupportedWalletsContent />
</QueryClientProvider>
);
}
🤖 Prompt for AI Agents
In apps/portal/src/components/others/AllSupportedWallets.tsx around lines 33 to
39, the AllSupportedWallets function component lacks an explicit return type.
Add the React.FC (or React.FunctionComponent) return type annotation to the
function declaration to comply with TypeScript coding guidelines for explicit
return types in components.

);
}

function AllSupportedWalletsContent() {
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add explicit return type to the component function.

-function AllSupportedWalletsContent() {
+function AllSupportedWalletsContent(): JSX.Element {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
function AllSupportedWalletsContent() {
-function AllSupportedWalletsContent() {
+function AllSupportedWalletsContent(): JSX.Element {
🤖 Prompt for AI Agents
In apps/portal/src/components/others/AllSupportedWallets.tsx at line 41, the
function AllSupportedWalletsContent lacks an explicit return type. Add the
appropriate React component return type, such as React.ReactElement or
JSX.Element, to the function signature to explicitly specify the return type of
the component.

Comment on lines +59 to +71
const filteredWallets = useMemo(() => {
if (!searchQuery) return wallets || [];
if (!wallets) return [];

setCurrentPage(1);
const query = searchQuery.toLowerCase();
return wallets.filter(
(wallet) =>
wallet.name.toLowerCase().includes(query) ||
wallet.id.toLowerCase().includes(query),
);
}, [wallets, searchQuery]);

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Remove side effect from useMemo and fix inefficient re-renders.

The setCurrentPage(1) call inside useMemo is a side effect that violates React best practices and will cause the component to re-render unnecessarily on every search query change.

Apply this diff to fix the issue:

+  // Reset page when search query changes
+  useEffect(() => {
+    setCurrentPage(1);
+  }, [searchQuery]);
+
   const filteredWallets = useMemo(() => {
     if (!searchQuery) return wallets || [];
     if (!wallets) return [];
 
-    setCurrentPage(1);
     const query = searchQuery.toLowerCase();
     return wallets.filter(
       (wallet) =>
         wallet.name.toLowerCase().includes(query) ||
         wallet.id.toLowerCase().includes(query),
     );
-  }, [wallets, searchQuery]);
+  }, [wallets, searchQuery]);

Don't forget to import useEffect:

-import { useMemo, useState } from "react";
+import { useEffect, useMemo, useState } from "react";
🤖 Prompt for AI Agents
In apps/portal/src/components/others/AllSupportedWallets.tsx around lines 59 to
71, remove the side effect call setCurrentPage(1) from inside the useMemo hook
because useMemo should be pure and not cause side effects. Instead, move
setCurrentPage(1) into a separate useEffect hook that runs whenever searchQuery
changes. This will prevent unnecessary re-renders and adhere to React best
practices. Also, ensure useEffect is imported from React.


async function WalletImage(props: { id: WalletId }) {
const img = await getWalletInfo(props.id, true);
function WalletImage(props: { id: WalletId }) {
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add explicit return type and consider adding error handling.

-function WalletImage(props: { id: WalletId }) {
+function WalletImage(props: { id: WalletId }): JSX.Element {

Also consider handling the error state from useQuery:

-  const { data: img } = useQuery({
+  const { data: img, error } = useQuery({
     queryKey: ["wallet-image", props.id],
     queryFn: () => getWalletInfo(props.id, true),
     staleTime: 1000 * 60 * 60 * 24, // 24 hours
   });

-  if (!img) {
+  if (!img || error) {
     return (
       <div className="rounded-lg bg-muted" style={{ width: 44, height: 44 }} />
     );
   }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
function WalletImage(props: { id: WalletId }) {
function WalletImage(props: { id: WalletId }): JSX.Element {
const { data: img, error } = useQuery({
queryKey: ["wallet-image", props.id],
queryFn: () => getWalletInfo(props.id, true),
staleTime: 1000 * 60 * 60 * 24, // 24 hours
});
if (!img || error) {
return (
<div className="rounded-lg bg-muted" style={{ width: 44, height: 44 }} />
);
}
// ...rest of rendering logic
}
🤖 Prompt for AI Agents
In apps/portal/src/components/others/AllSupportedWallets.tsx at line 228, the
WalletImage function lacks an explicit return type and does not handle potential
errors from the useQuery hook. Add an explicit return type to the WalletImage
function, such as React.ReactElement or JSX.Element, and include error handling
logic for the useQuery result, for example by checking for an error state and
rendering an appropriate fallback UI or message.

@vercel vercel bot temporarily deployed to Preview – thirdweb-www July 25, 2025 08:52 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui July 25, 2025 08:52 Inactive
@vercel vercel bot temporarily deployed to Preview – nebula July 25, 2025 08:52 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground July 25, 2025 08:52 Inactive
@joaquim-verges joaquim-verges changed the title Add search and pagination to wallet list [Docs] Add search and pagination to wallet list Jul 25, 2025
@joaquim-verges joaquim-verges merged commit c80eed3 into main Jul 25, 2025
24 checks passed
@joaquim-verges joaquim-verges deleted the cursor/add-search-and-pagination-to-wallet-list-54e0 branch July 25, 2025 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Portal Involves changes to the Portal (docs) codebase.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants