Skip to content

Dashboard: Reduce useThirdwebClient hook usage #3 #7226

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

MananTank
Copy link
Member

@MananTank MananTank commented May 30, 2025


PR-Codex overview

This PR primarily focuses on enhancing the integration of the ThirdwebClient across various components in the application, ensuring a consistent client usage and improving functionality related to blockchain interactions.

Detailed summary

  • Added client prop to multiple components for ThirdwebClient.
  • Replaced useThirdwebClient with direct client prop usage.
  • Updated components to accept and utilize the client parameter.
  • Ensured proper client initialization in various pages and components.
  • Improved transaction handling and user interface interactions with the blockchain.

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

Summary by CodeRabbit

  • Refactor
    • Updated various components to receive a client instance as a prop instead of obtaining it internally, improving consistency and making client usage more explicit throughout the app.
    • Enhanced component interfaces to require a client prop where necessary, ensuring proper client context is passed across the dashboard.
    • Adjusted authentication and layout flows to support explicit client instantiation and propagation.

Copy link

changeset-bot bot commented May 30, 2025

⚠️ No Changeset found

Latest commit: b84db12

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

Copy link

vercel bot commented May 30, 2025

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

Name Status Preview Comments Updated (UTC)
thirdweb-www ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 30, 2025 6:43pm
4 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs-v2 ⬜️ Skipped (Inspect) May 30, 2025 6:43pm
login ⬜️ Skipped (Inspect) May 30, 2025 6:43pm
thirdweb_playground ⬜️ Skipped (Inspect) May 30, 2025 6:43pm
wallet-ui ⬜️ Skipped (Inspect) May 30, 2025 6:43pm

@vercel vercel bot temporarily deployed to Preview – docs-v2 May 30, 2025 15:55 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground May 30, 2025 15:55 Inactive
@vercel vercel bot temporarily deployed to Preview – login May 30, 2025 15:55 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui May 30, 2025 15:55 Inactive
Copy link
Contributor

coderabbitai bot commented May 30, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This change refactors the usage of the ThirdwebClient instance throughout the application. Instead of obtaining the client via the useThirdwebClient hook within components, the client is now explicitly passed as a prop to all components that require it. This update affects component signatures, prop drilling, and client instantiation patterns across account, dashboard, team, ecosystem, and transaction-related modules.

Changes

File(s) Change Summary
.../components/client/FaucetButton.tsx, .../components/client/PayModal.tsx, .../components/server/BuyFundsSection.tsx, .../components/server/FaucetSection.tsx, .../components/client/partner-form.client.tsx, .../components/client/update-partner-form.client.tsx, .../components/client/add-partner-form.client.tsx, .../components/client/allowed-operations-section.tsx, .../components/client/TransactionRestrictions.tsx, .../components/client/TypedDataRestrictions.tsx, .../components/server/BuyFundsSection.tsx, .../components/server/FaucetSection.tsx, .../components/client/PayModal.tsx, .../components/client/FaucetButton.tsx Updated component signatures to accept a client: ThirdwebClient prop instead of using useThirdwebClient internally; removed related imports and local hook usage.
.../components/autoconnect.tsx, .../token-id.tsx, .../ModuleForm.tsx, .../install-module-params.tsx, .../TransactionSimulator.tsx, .../ecosystem-header.client.tsx Removed useThirdwebClient usage; replaced with explicit client prop or direct instantiation via getClientThirdwebClient.
.../page.tsx, .../profile/[addressOrEns]/page.tsx, .../login/page.tsx, .../account/layout.tsx, .../team/[team_slug]/(team)/~/settings/layout.tsx, .../team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/configuration/add-partner/page.tsx, .../team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/configuration/partners/[partner_id]/edit/page.tsx, .../team/[team_slug]/[project_slug]/(sidebar)/engine/cloud/page.tsx Instantiates client using getClientThirdwebClient and passes it down as a prop to relevant child components.
.../ProfileUI.tsx, .../profile-header.tsx, .../account/components/AccountHeader.tsx, .../account/contracts/DeployedContractsPageHeader.tsx, .../account/contracts/_components/DeployViaCLIOrImportCard.tsx, .../account/contracts/_components/DeployedContractsPage.tsx, .../account/[contractAddress]/account/AccountPage.tsx, .../account/[contractAddress]/account/components/deposit-native.tsx, .../account/[contractAddress]/modules/components/ModuleForm.tsx, .../account/[contractAddress]/modules/components/install-module-params.tsx, .../account/[contractAddress]/nfts/[tokenId]/token-id.tsx Updated component signatures and usages to accept and propagate client prop; removed internal hook usage.
.../components/buttons/MismatchButton.tsx Added client prop propagation through insufficient funds and faucet-related components.
.../team/[team_slug]/(team)/~/settings/SettingsLayout.tsx Now receives and forwards a client prop to sidebar components.
.../team/[team_slug]/[project_slug]/(sidebar)/engine/cloud/analytics/ftux.client.tsx, .../engine/cloud/analytics/send-test-tx.client.tsx, .../engine/cloud/analytics/tx-table/tx-table-ui.tsx Added client prop to analytics and transaction-related components and their children; removed hook usage.
.../login/LoginPage.tsx Added client prop to login and onboarding components, updating their signatures and usage hierarchy.

Sequence Diagram(s)

sequenceDiagram
    participant ParentComponent
    participant getClientThirdwebClient
    participant ChildComponent
    participant SubComponent

    ParentComponent->>getClientThirdwebClient: Obtain client
    ParentComponent->>ChildComponent: Pass client as prop
    ChildComponent->>SubComponent: Pass client as prop
    SubComponent->>Thirdweb API: Use client for blockchain operation
Loading

Suggested reviewers

  • MananTank

🪧 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 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.

@MananTank MananTank marked this pull request as ready for review May 30, 2025 15:55
@MananTank MananTank requested review from a team as code owners May 30, 2025 15:55
Copy link
Member Author

MananTank commented May 30, 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.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions bot added the Dashboard Involves changes to the Dashboard. label May 30, 2025
Copy link

codecov bot commented May 30, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 55.62%. Comparing base (a440621) to head (b84db12).
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7226   +/-   ##
=======================================
  Coverage   55.62%   55.62%           
=======================================
  Files         908      908           
  Lines       58575    58575           
  Branches     4134     4134           
=======================================
  Hits        32582    32582           
  Misses      25887    25887           
  Partials      106      106           
Flag Coverage Δ
packages 55.62% <ø> (ø)
🚀 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.

Copy link
Contributor

github-actions bot commented May 30, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 62.14 KB (0%) 1.3 s (0%) 248 ms (+223.44% 🔺) 1.5 s
thirdweb (cjs) 344.83 KB (0%) 6.9 s (0%) 652 ms (+7.99% 🔺) 7.6 s
thirdweb (minimal + tree-shaking) 5.7 KB (0%) 114 ms (0%) 62 ms (+1231.37% 🔺) 176 ms
thirdweb/chains (tree-shaking) 531 B (0%) 11 ms (0%) 18 ms (+645.97% 🔺) 29 ms
thirdweb/react (minimal + tree-shaking) 19.52 KB (0%) 391 ms (0%) 84 ms (+644.36% 🔺) 474 ms

Copy link
Member

jnsdls commented May 30, 2025

@coderabbitai review

Copy link
Contributor

coderabbitai bot commented May 30, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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

🔭 Outside diff range comments (1)
apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/configuration/components/client/allowed-operations-section.tsx (1)

581-581: 🛠️ Refactor suggestion

Inconsistent client usage pattern detected.

The UserOpTransactions component within PersonalSignRestrictions still uses the useThirdwebClient() hook, which is inconsistent with the refactoring pattern applied to other components in this file.

For consistency, consider passing the client prop through PersonalSignRestrictions to UserOpTransactions:

function PersonalSignRestrictions({
  control,
  index,
+  client,
}: {
  control: Control<PartnerFormValues>;
  index: number;
+  client: ThirdwebClient;
}) {
  // ... existing code ...
  
  // Then update UserOpTransactions call to:
  <UserOpTransactions
    control={control}
    opIndex={index}
    signIndex={signIndex}
+    client={client}
  />
  
  // And update UserOpTransactions function:
  function UserOpTransactions({
    control,
    opIndex,
    signIndex,
+    client,
  }: {
    control: Control<PartnerFormValues>;
    opIndex: number;
    signIndex: number;
+    client: ThirdwebClient;
  }) {
-    const client = useThirdwebClient();
    // ... rest of the component
  }

Also update the parent component call:

<PersonalSignRestrictions 
  control={control} 
  index={index}
+  client={client}
/>
🧹 Nitpick comments (2)
apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/configuration/partners/[partner_id]/edit/page.tsx (1)

3-3: Long import path follows project structure

While the relative import path is quite long, it appears to follow the established directory structure of the project. Consider if this could benefit from a path alias configuration for better maintainability.

apps/dashboard/src/app/(app)/account/layout.tsx (1)

22-27: Good implementation of client creation at layout level.

The refactor correctly fetches the auth token and creates the client instance at the layout level. However, consider improving the error handling to provide more specific feedback about which authentication requirement failed.

Consider this improvement for better error handling:

-  if (!teams || !accountAddress || !authToken) {
-    loginRedirect("/account");
-  }
+  if (!teams) {
+    console.error("Failed to fetch teams");
+    loginRedirect("/account");
+  }
+  if (!accountAddress || !authToken) {
+    console.error("Authentication failed - missing token or address");
+    loginRedirect("/account");
+  }

Also applies to: 29-31

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6d2fef0 and 759d325.

📒 Files selected for processing (36)
  • apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/(chainPage)/components/client/FaucetButton.tsx (1 hunks)
  • apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/(chainPage)/components/client/PayModal.tsx (2 hunks)
  • apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/(chainPage)/components/server/BuyFundsSection.tsx (3 hunks)
  • apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/(chainPage)/components/server/FaucetSection.tsx (3 hunks)
  • apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/(chainPage)/page.tsx (3 hunks)
  • apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/account/AccountPage.tsx (1 hunks)
  • apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/account/components/deposit-native.tsx (2 hunks)
  • apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/modules/components/ModuleForm.tsx (3 hunks)
  • apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/modules/components/install-module-params.tsx (2 hunks)
  • apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/[tokenId]/token-id.tsx (1 hunks)
  • apps/dashboard/src/app/(app)/(dashboard)/profile/[addressOrEns]/ProfileUI.tsx (1 hunks)
  • apps/dashboard/src/app/(app)/(dashboard)/profile/[addressOrEns]/components/profile-header.tsx (2 hunks)
  • apps/dashboard/src/app/(app)/(dashboard)/profile/[addressOrEns]/page.tsx (2 hunks)
  • apps/dashboard/src/app/(app)/(dashboard)/tools/transaction-simulator/components/TransactionSimulator.tsx (2 hunks)
  • apps/dashboard/src/app/(app)/account/components/AccountHeader.tsx (3 hunks)
  • apps/dashboard/src/app/(app)/account/contracts/DeployedContractsPageHeader.tsx (1 hunks)
  • apps/dashboard/src/app/(app)/account/contracts/_components/DeployViaCLIOrImportCard.tsx (1 hunks)
  • apps/dashboard/src/app/(app)/account/contracts/_components/DeployedContractsPage.tsx (2 hunks)
  • apps/dashboard/src/app/(app)/account/layout.tsx (4 hunks)
  • apps/dashboard/src/app/(app)/components/autoconnect.tsx (1 hunks)
  • apps/dashboard/src/app/(app)/login/LoginPage.tsx (8 hunks)
  • apps/dashboard/src/app/(app)/login/page.tsx (2 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/components/ecosystem-header.client.tsx (1 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/configuration/add-partner/page.tsx (3 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/configuration/components/client/add-partner-form.client.tsx (3 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/configuration/components/client/allowed-operations-section.tsx (4 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/configuration/components/client/partner-form.client.tsx (3 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/configuration/components/client/update-partner-form.client.tsx (3 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/configuration/partners/[partner_id]/edit/page.tsx (3 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/SettingsLayout.tsx (2 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/layout.tsx (2 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/cloud/analytics/ftux.client.tsx (5 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/cloud/analytics/send-test-tx.client.tsx (5 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/cloud/analytics/tx-table/tx-table-ui.tsx (3 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/cloud/page.tsx (1 hunks)
  • apps/dashboard/src/components/buttons/MismatchButton.tsx (6 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (13)
apps/dashboard/src/app/(app)/login/page.tsx (1)
apps/dashboard/src/@/constants/thirdweb-client.client.ts (1)
  • getClientThirdwebClient (3-11)
apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/configuration/partners/[partner_id]/edit/page.tsx (2)
packages/engine/src/client/client.gen.ts (1)
  • client (24-28)
apps/dashboard/src/@/constants/thirdweb-client.client.ts (1)
  • getClientThirdwebClient (3-11)
apps/dashboard/src/app/(app)/(dashboard)/tools/transaction-simulator/components/TransactionSimulator.tsx (2)
packages/engine/src/client/client.gen.ts (1)
  • client (24-28)
apps/dashboard/src/@/constants/thirdweb-client.client.ts (1)
  • getClientThirdwebClient (3-11)
apps/dashboard/src/app/(app)/(dashboard)/profile/[addressOrEns]/page.tsx (1)
apps/dashboard/src/@/constants/thirdweb-client.client.ts (1)
  • getClientThirdwebClient (3-11)
apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/cloud/page.tsx (1)
packages/engine/src/client/client.gen.ts (1)
  • client (24-28)
apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/configuration/add-partner/page.tsx (2)
packages/engine/src/client/client.gen.ts (1)
  • client (24-28)
apps/dashboard/src/@/constants/thirdweb-client.client.ts (1)
  • getClientThirdwebClient (3-11)
apps/dashboard/src/app/(app)/(dashboard)/profile/[addressOrEns]/ProfileUI.tsx (1)
apps/dashboard/src/app/(app)/(dashboard)/profile/[addressOrEns]/components/profile-header.tsx (1)
  • ProfileHeader (15-55)
apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/SettingsLayout.tsx (2)
apps/dashboard/src/@/api/team.ts (1)
  • Team (9-9)
packages/thirdweb/src/exports/thirdweb.ts (1)
  • ThirdwebClient (26-26)
apps/dashboard/src/app/(app)/account/contracts/_components/DeployViaCLIOrImportCard.tsx (3)
packages/thirdweb/src/exports/thirdweb.ts (1)
  • ThirdwebClient (26-26)
apps/dashboard/src/hooks/analytics/useTrack.ts (1)
  • useTrack (13-45)
apps/dashboard/src/components/contract-components/import-contract/modal.tsx (1)
  • ImportModal (44-76)
apps/dashboard/src/app/(app)/components/autoconnect.tsx (2)
packages/engine/src/client/client.gen.ts (1)
  • client (24-28)
apps/dashboard/src/@/constants/thirdweb-client.client.ts (1)
  • getClientThirdwebClient (3-11)
apps/dashboard/src/app/(app)/account/contracts/DeployedContractsPageHeader.tsx (3)
packages/thirdweb/src/exports/thirdweb.ts (1)
  • ThirdwebClient (26-26)
apps/dashboard/src/hooks/analytics/useTrack.ts (1)
  • useTrack (13-45)
apps/dashboard/src/components/contract-components/import-contract/modal.tsx (1)
  • ImportModal (44-76)
apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/configuration/components/client/allowed-operations-section.tsx (2)
apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/configuration/components/client/partner-form.client.tsx (1)
  • PartnerFormValues (26-26)
packages/thirdweb/src/exports/thirdweb.ts (1)
  • ThirdwebClient (26-26)
apps/dashboard/src/components/buttons/MismatchButton.tsx (2)
packages/engine/src/client/client.gen.ts (1)
  • client (24-28)
packages/thirdweb/src/exports/thirdweb.ts (1)
  • ThirdwebClient (26-26)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
  • GitHub Check: Graphite / mergeability_check
🔇 Additional comments (57)
apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/account/AccountPage.tsx (1)

44-44: LGTM! Consistent with the client prop refactoring pattern.

The addition of client={contract.client} to the DepositNative component follows the established pattern of explicitly passing ThirdwebClient instances as props instead of using the useThirdwebClient hook internally. Using contract.client as the source is logical and maintains consistency.

apps/dashboard/src/app/(app)/login/page.tsx (2)

1-1: LGTM! Proper import addition for client refactoring.

The import of getClientThirdwebClient is necessary to support the new client prop pattern.


31-31: LGTM! Appropriate client usage for login context.

Calling getClientThirdwebClient() without parameters is correct for the login page since users aren't authenticated yet. The function handles undefined JWT and team ID gracefully.

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/cloud/page.tsx (2)

81-84: LGTM! Proper authenticated client creation.

The client is correctly created using getClientThirdwebClient with both jwt (authToken) and teamId parameters, which is appropriate for this authenticated context.


95-95: LGTM! Consistent client prop passing.

The client prop is correctly passed to the EngineChecklist component, following the established refactoring pattern of explicit client prop injection.

apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/configuration/add-partner/page.tsx (3)

2-2: LGTM! Required import for client refactoring.

The import of getClientThirdwebClient supports the new client prop pattern being implemented across the dashboard.


31-34: LGTM! Proper authenticated client creation.

The client is correctly instantiated with both jwt (authToken) and teamId (team.id) parameters, which is appropriate for this authenticated ecosystem management context.


53-53: LGTM! Consistent client prop injection.

The client prop is correctly passed to the AddPartnerForm component, aligning with the broader refactoring to standardize ThirdwebClient usage across dashboard components.

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/[tokenId]/token-id.tsx (1)

175-177: LGTM! Consistent client usage from contract object.

The change from using a local client variable (obtained via useThirdwebClient()) to using contract.client is correct and aligns with the refactoring objectives. This ensures the same client instance is used consistently and avoids duplicate client creation.

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/(chainPage)/components/server/BuyFundsSection.tsx (2)

3-3: LGTM! Proper type import and props interface update.

The addition of the ThirdwebClient type import and the client prop to the component interface follows the refactoring pattern correctly and maintains proper TypeScript typing.

Also applies to: 12-12


50-50: LGTM! Correct client prop passing.

The client prop is properly passed down to the PayModalButton component, following the established pattern of explicit client propagation through the component tree.

apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/components/ecosystem-header.client.tsx (1)

156-156: LGTM! Consistent use of client from props.

The change from using a local client variable (obtained via useThirdwebClient()) to using props.client is correct and aligns with the refactoring pattern. This makes the client dependency explicit and improves consistency across the codebase.

apps/dashboard/src/app/(app)/(dashboard)/tools/transaction-simulator/components/TransactionSimulator.tsx (1)

27-27:

✅ Verification successful

LGTM with verification needed for client configuration.

The change from useThirdwebClient() to getClientThirdwebClient() follows the refactoring pattern but uses a different approach than prop drilling. This appears appropriate for a component that doesn't receive the client from parent props.

However, please verify that calling getClientThirdwebClient() without parameters provides the correct client configuration for this use case. The function accepts optional jwt and teamId parameters, and we should ensure that authentication and team context are properly handled if required for transaction simulation.

Also applies to: 64-64


🏁 Script executed:

#!/bin/bash
# Description: Check if TransactionSimulator component needs specific client configuration
# by examining usage patterns and authentication requirements

# Check if other components using getClientThirdwebClient pass parameters
rg -A 3 -B 3 "getClientThirdwebClient\(" --type tsx --type ts

# Check if TransactionSimulator is used in authenticated contexts
rg -A 5 -B 5 "TransactionSimulator" --type tsx --type ts

Length of output: 176


🏁 Script executed:

#!/bin/bash
# Locate all definitions and usages of getClientThirdwebClient in .ts/.tsx files
rg -n -C3 "getClientThirdwebClient" -g "*.ts" -g "*.tsx"

# Specifically inspect the declaration (to see default parameters)
rg -n -C5 "function getClientThirdwebClient" -g "*.ts" -g "*.tsx"

# Confirm how many arguments callers pass elsewhere
rg -n "getClientThirdwebClient(" -g "*.ts" -g "*.tsx"

Length of output: 67924


🏁 Script executed:

#!/bin/bash
# Locate the thirdweb-client.client.ts file
file_path=$(find . -type f -name "thirdweb-client.client.ts" | head -n1)
echo "Definition file: $file_path"

# Show the function definition with context
rg -n -C5 "getClientThirdwebClient" "$file_path"

Length of output: 677


🏁 Script executed:

#!/bin/bash
# Locate the thirdweb.server.ts file defining getConfiguredThirdwebClient
server_file=$(find . -type f -name "thirdweb.server.ts" | head -n1)
echo "Server definition file: $server_file"

# Show the getConfiguredThirdwebClient implementation with context
rg -n -C10 "export function getConfiguredThirdwebClient" "$server_file"

Length of output: 1256


Approve: Default client configuration is valid for TransactionSimulator

Verified that getClientThirdwebClient() accepts optional jwt and teamId and defaults both to undefined, producing an unauthenticated client. Since the TransactionSimulator component does not require a user’s auth or team context, calling it without parameters is correct.

• File apps/dashboard/src/app/(app)/(dashboard)/tools/transaction-simulator/components/TransactionSimulator.tsx
– Lines 27 & 64: getClientThirdwebClient()
• No changes needed.

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/(chainPage)/page.tsx (3)

2-2: LGTM: Clean import addition

The import of getClientThirdwebClient follows the expected pattern for this refactor.


20-20: LGTM: Appropriate client creation for public chain page

Creating the client without authentication parameters is correct for a chain page that serves public functionality like faucet and buy funds operations.


47-50: LGTM: Consistent prop passing pattern

The client is properly passed to both FaucetSection and BuyFundsSection components, maintaining consistency with the refactor objectives.

apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/configuration/partners/[partner_id]/edit/page.tsx (2)

33-36: LGTM: Proper authenticated client creation

The client is correctly created with JWT token and team ID parameters, which is essential for partner management operations that require authentication and team context.


77-77: LGTM: Client prop passed to form component

The client is properly passed to UpdatePartnerForm, maintaining the refactor pattern of explicit dependency injection.

apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/configuration/components/client/add-partner-form.client.tsx (3)

5-5: LGTM: Proper type import

The ThirdwebClient type import is correctly added to support the new client prop interface.


14-20: LGTM: Clean component interface update

The component props are properly extended to include the required client prop with correct TypeScript typing.


70-70: LGTM: Consistent prop drilling

The client is properly passed down to the PartnerForm component, maintaining the refactor pattern of explicit client dependency injection.

apps/dashboard/src/app/(app)/(dashboard)/profile/[addressOrEns]/page.tsx (2)

1-2: LGTM: Improved import consistency

The addition of getClientThirdwebClient import and the change from relative to absolute path for serverThirdwebClient improves import consistency across the codebase.


31-31: LGTM: Appropriate client creation for profile page

Creating the client without authentication parameters is correct for a profile page, and properly passing it to ProfileUI maintains the refactor pattern.

apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/SettingsLayout.tsx (1)

8-8: LGTM! Clean refactoring to explicit client prop passing.

The changes correctly implement the intended pattern of removing useThirdwebClient hook usage in favor of explicit prop passing. The ThirdwebClient type is properly imported and the client prop is correctly typed and passed down to the TeamSettingsSidebar component.

Also applies to: 21-21, 54-54

apps/dashboard/src/app/(app)/(dashboard)/profile/[addressOrEns]/ProfileUI.tsx (1)

4-4: LGTM! Consistent refactoring pattern applied.

The changes properly implement the explicit client prop pattern:

  • Correct import of ThirdwebClient type
  • Proper prop type declaration
  • Appropriate prop passing to ProfileHeader component

The implementation aligns with the ProfileHeader component's updated signature that expects a client prop.

Also applies to: 12-12, 18-22

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/(chainPage)/components/server/FaucetSection.tsx (1)

1-1: LGTM! Proper implementation of client prop pattern.

The changes correctly implement the explicit client prop passing pattern:

  • Appropriate ThirdwebClient type import
  • Correct prop type declaration in the component signature
  • Clean destructuring of the client prop
  • Proper forwarding to the FaucetButton component

The implementation is consistent with the broader refactoring effort.

Also applies to: 12-14, 49-49

apps/dashboard/src/app/(app)/account/contracts/_components/DeployViaCLIOrImportCard.tsx (1)

9-9: LGTM! Consistent application of the refactoring pattern.

The changes properly implement the explicit client prop passing:

  • Correct ThirdwebClient type import
  • Appropriate prop type declaration
  • Proper forwarding to the ImportModal component

This aligns with the ImportModal component's signature that expects a client prop, as confirmed by the relevant code snippets.

Also applies to: 14-14, 23-23

apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/configuration/components/client/partner-form.client.tsx (1)

20-20: LGTM! Clean ThirdwebClient prop integration.

The implementation correctly adds the client prop to the component interface and passes it through to child components. The type annotations are accurate and the prop drilling follows the established pattern.

Also applies to: 36-36, 44-44, 348-348

apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/configuration/components/client/update-partner-form.client.tsx (1)

5-5: LGTM! Consistent client prop implementation.

The component correctly accepts the client prop and passes it through to the PartnerForm component. The TypeScript interface is properly updated and the implementation follows the established refactor pattern.

Also applies to: 15-15, 21-21, 74-74

apps/dashboard/src/app/(app)/account/contracts/_components/DeployedContractsPage.tsx (1)

23-23: LGTM! Proper client prop propagation.

The component correctly passes the client prop to both child components (DeployedContractsPageHeader and DeployViaCLIOrImportCard). The prop access pattern using props.client is consistent and appropriate.

Also applies to: 32-32

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/modules/components/ModuleForm.tsx (1)

183-183: LGTM! Excellent refactor from hook to prop-based client access.

The changes consistently replace useThirdwebClient() hook usage with direct access to contract.client. This improves explicit dependency management and aligns with the broader refactor pattern. The ThirdwebContract type correctly provides the client property, making this a clean and appropriate change.

Also applies to: 232-232, 256-256

apps/dashboard/src/app/(app)/account/components/AccountHeader.tsx (2)

10-10: LGTM! Proper type import and prop addition.

The ThirdwebClient type import and the addition of the client prop to the component signature are correctly implemented.

Also applies to: 26-26


52-54: LGTM! Consistent client prop passing.

The client prop is correctly passed to both the CustomConnectWallet component and included in the headerProps object, ensuring proper client propagation throughout the component tree.

Also applies to: 61-61

apps/dashboard/src/app/(app)/components/autoconnect.tsx (1)

2-2: LGTM! Improved client instantiation pattern.

Moving from useThirdwebClient hook to module-level getClientThirdwebClient() call improves performance by avoiding client re-instantiation on every render and makes the dependency more explicit.

Also applies to: 6-6

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/(chainPage)/components/client/PayModal.tsx (1)

7-7: LGTM! Proper client prop integration.

The component correctly:

  • Imports the ThirdwebClient type
  • Accepts the client prop in its signature
  • Passes the client prop to the PayEmbed component

This maintains functionality while following the consistent client prop passing pattern.

Also applies to: 11-15, 41-41

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/(chainPage)/components/client/FaucetButton.tsx (2)

75-85: LGTM! Correct client prop integration.

The component signature is properly updated to accept the client: ThirdwebClient prop, and the typing is correct. This follows the consistent pattern of explicit client prop passing instead of using the useThirdwebClient hook internally.


92-96: LGTM! Consistent client usage throughout component.

The passed client prop is correctly used in:

  • useWalletBalance hook
  • SendFundsToFaucetModalButton component
  • CustomConnectWallet component

This ensures proper client propagation and maintains functionality while following the new architecture pattern.

Also applies to: 188-188, 410-410

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/cloud/analytics/ftux.client.tsx (1)

7-7: Excellent refactoring implementation!

The ThirdwebClient prop refactoring is implemented correctly with proper attention to detail:

  • Type import is appropriately added
  • Props interface is properly extended
  • Client prop is correctly passed to both SendTestTransaction components
  • Most importantly, the useMemo dependency array is updated to include props.client (line 83), ensuring the component re-renders when the client changes

This refactoring improves dependency explicitness and follows React best practices.

Also applies to: 21-21, 66-66, 83-83, 96-96

apps/dashboard/src/app/(app)/account/contracts/DeployedContractsPageHeader.tsx (1)

9-9: Consistent refactoring implementation!

The ThirdwebClient prop refactoring follows the established pattern correctly:

  • Proper type import
  • Clean props interface extension
  • Client prop correctly passed to the ImportModal component

This maintains consistency with the broader codebase refactoring effort.

Also applies to: 14-14, 22-22

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/modules/components/install-module-params.tsx (1)

4-4: Well-executed hook refactoring!

The refactoring of the useModuleInstallParams hook correctly implements the client prop pattern:

  • Appropriate type import
  • Clean props interface extension
  • Proper prop destructuring
  • Client correctly passed to getModuleInstalledParams

Extending this refactoring pattern to custom hooks maintains consistency across the codebase.

Also applies to: 23-25, 30-30

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/account/components/deposit-native.tsx (1)

8-8: Clean component refactoring implementation!

The ThirdwebClient prop refactoring in the DepositNative component is well-executed:

  • Type import properly updated
  • Props interface cleanly extended
  • Client prop correctly destructured
  • Client properly utilized in the prepareTransaction call

The transaction logic remains intact while benefiting from explicit dependency injection.

Also applies to: 17-17, 25-25, 66-66

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/cloud/analytics/send-test-tx.client.tsx (2)

24-24: LGTM: Clean refactoring to explicit client prop pattern.

The addition of the ThirdwebClient import and the client prop to the component signature aligns well with the standardization effort across the codebase.

Also applies to: 45-45


203-203: LGTM: Consistent client prop propagation.

The client prop is correctly passed to all child components (SmartAccountCell and SingleNetworkSelector) that require the ThirdwebClient instance.

Also applies to: 217-217, 239-239

apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/layout.tsx (3)

2-2: LGTM: Proper imports for enhanced authentication flow.

The addition of getClientThirdwebClient, getAuthToken, and loginRedirect imports supports the improved authentication and client instantiation pattern.

Also applies to: 5-6


17-21: LGTM: Robust authentication check with proper error handling.

The concurrent fetching of authentication token alongside account and team data, followed by the authentication check and redirect, ensures proper security before client creation.

Also applies to: 23-25


31-37: LGTM: Proper client instantiation and prop passing.

The client is correctly created using the authenticated token and team ID, then passed to the SettingsLayout component, maintaining the explicit client propagation pattern.

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/engine/cloud/analytics/tx-table/tx-table-ui.tsx (2)

306-309: LGTM: Component signature updated for explicit client handling.

The TxChainCell component now properly accepts a client prop, maintaining consistency with the refactoring pattern across the codebase.


158-161: LGTM: Proper client prop usage and propagation.

The client prop is correctly passed to TxChainCell and subsequently used in the ChainIconClient component, ensuring proper ThirdwebClient instance flow.

Also applies to: 326-326

apps/dashboard/src/app/(app)/login/LoginPage.tsx (2)

16-16: LGTM: Comprehensive client prop integration across component hierarchy.

The addition of ThirdwebClient import and explicit client props to all relevant components (LoginAndOnboardingPage, LoginAndOnboardingPageContent, CustomConnectEmbed) ensures consistent client handling throughout the login flow.

Also applies to: 80-80, 166-166, 270-270


122-122: LGTM: Thorough client prop propagation through component tree.

The client prop is systematically passed down through the entire component hierarchy, from the top-level components to the final ConnectEmbed usage, maintaining the explicit client pattern consistently.

Also applies to: 234-234, 261-261, 328-328

apps/dashboard/src/app/(app)/(dashboard)/profile/[addressOrEns]/components/profile-header.tsx (1)

5-5: LGTM! Clean refactoring to explicit client prop.

The changes correctly implement the pattern of passing ThirdwebClient as a prop instead of using the useThirdwebClient hook internally. This improves dependency clarity and makes the component more testable.

Also applies to: 18-18, 21-21

apps/dashboard/src/app/(app)/account/layout.tsx (1)

33-36: Excellent client propagation pattern.

The client is properly created using getClientThirdwebClient and correctly passed down through the component hierarchy. This establishes a clean dependency flow from layout to child components.

Also applies to: 45-45, 59-59, 75-75

apps/dashboard/src/components/buttons/MismatchButton.tsx (2)

38-43: Good addition of ThirdwebClient to existing imports.

The import statement is properly updated to include ThirdwebClient type needed for the prop drilling implementation.


280-280: Excellent prop drilling implementation.

The client is correctly passed down through the component hierarchy: MismatchButtonNoFundsDialogContentGetFundsFromFaucetFaucetButton. This maintains the existing functionality while enabling the new explicit client passing pattern.

Also applies to: 342-342, 401-401, 442-442, 473-473

apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/ecosystem/[slug]/(active)/configuration/components/client/allowed-operations-section.tsx (3)

26-26: Proper client prop addition to main component.

The ThirdwebClient type import and prop addition to AllowedOperationsSection correctly follows the refactoring pattern.

Also applies to: 33-33, 40-40


148-152: Good client prop propagation to child components.

The client is correctly passed to both TransactionRestrictions and TypedDataRestrictions components, maintaining consistency in the refactoring approach.

Also applies to: 157-161


196-200: Correct client parameter addition to restriction components.

Both TransactionRestrictions and TypedDataRestrictions properly accept the client parameter and use it in their SingleNetworkSelector components.

Also applies to: 327-331

Copy link
Contributor

graphite-app bot commented May 30, 2025

Merge activity

<!--

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

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

## Notes for the reviewer

Anything important to call out? Be sure to also clarify these in your comments.

## How to test

Unit tests, playground, etc.

-->

<!-- start pr-codex -->

---

## PR-Codex overview
This PR primarily focuses on updating the usage of the `client` prop throughout various components in the application, replacing instances of `useThirdwebClient` with a more consistent approach using `getClientThirdwebClient`.

### Detailed summary
- Added `client` prop to multiple components including `AccountPage`, `DeployedContractsPage`, and `FaucetButton`.
- Replaced `useThirdwebClient` with `getClientThirdwebClient` in various files.
- Ensured consistency in passing the `client` prop across components.
- Updated the `ProfileHeader`, `PayModalButton`, and `SendTestTransaction` to accept `client` as a prop.
- Modified forms and sections to utilize the `client` prop for better integration with Thirdweb services.

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

<!-- end pr-codex -->

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

- **Refactor**
  - Updated various components to receive a client instance as a prop instead of obtaining it internally, improving consistency and making client usage more explicit throughout the app.
  - Enhanced component interfaces to require a client prop where necessary, ensuring proper client context is passed across the dashboard.
  - Adjusted authentication and layout flows to support explicit client instantiation and propagation.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@graphite-app graphite-app bot force-pushed the 05-30-dashboard_reduce_usethirdwebclient_hook_usage_2 branch from 6d2fef0 to a440621 Compare May 30, 2025 18:35
@graphite-app graphite-app bot force-pushed the 05-30-dashboard_reduce_usethirdwebclient_hook_usage_3 branch from 759d325 to b84db12 Compare May 30, 2025 18:36
@vercel vercel bot temporarily deployed to Preview – wallet-ui May 30, 2025 18:36 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 May 30, 2025 18:36 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground May 30, 2025 18:36 Inactive
@vercel vercel bot temporarily deployed to Preview – login May 30, 2025 18:36 Inactive
Base automatically changed from 05-30-dashboard_reduce_usethirdwebclient_hook_usage_2 to main May 30, 2025 18:44
@graphite-app graphite-app bot merged commit b84db12 into main May 30, 2025
22 checks passed
@graphite-app graphite-app bot deleted the 05-30-dashboard_reduce_usethirdwebclient_hook_usage_3 branch May 30, 2025 18:46
@vercel vercel bot temporarily deployed to Production – thirdweb_playground May 30, 2025 18:46 Inactive
@vercel vercel bot temporarily deployed to Production – login May 30, 2025 18:46 Inactive
@vercel vercel bot temporarily deployed to Production – docs-v2 May 30, 2025 18:46 Inactive
@vercel vercel bot temporarily deployed to Production – wallet-ui May 30, 2025 18:46 Inactive
@vercel vercel bot temporarily deployed to Production – thirdweb-www May 30, 2025 18:57 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dashboard Involves changes to the Dashboard.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants