-
Notifications
You must be signed in to change notification settings - Fork 560
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
Dashboard: Reduce useThirdwebClient hook usage #3 #7226
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThis change refactors the usage of the Changes
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
Suggested reviewers
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
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. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
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
🚀 New features to boost your workflow:
|
size-limit report 📦
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this 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 suggestionInconsistent client usage pattern detected.
The
UserOpTransactions
component withinPersonalSignRestrictions
still uses theuseThirdwebClient()
hook, which is inconsistent with the refactoring pattern applied to other components in this file.For consistency, consider passing the client prop through
PersonalSignRestrictions
toUserOpTransactions
: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 structureWhile 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
📒 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 theDepositNative
component follows the established pattern of explicitly passing ThirdwebClient instances as props instead of using theuseThirdwebClient
hook internally. Usingcontract.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 bothjwt
(authToken) andteamId
parameters, which is appropriate for this authenticated context.
95-95
: LGTM! Consistent client prop passing.The
client
prop is correctly passed to theEngineChecklist
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) andteamId
(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 theAddPartnerForm
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 viauseThirdwebClient()
) to usingcontract.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 theclient
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 viauseThirdwebClient()
) to usingprops.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()
togetClientThirdwebClient()
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 optionaljwt
andteamId
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 tsLength 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 additionThe import of
getClientThirdwebClient
follows the expected pattern for this refactor.
20-20
: LGTM: Appropriate client creation for public chain pageCreating 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 patternThe client is properly passed to both
FaucetSection
andBuyFundsSection
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 creationThe 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 componentThe 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 importThe
ThirdwebClient
type import is correctly added to support the new client prop interface.
14-20
: LGTM: Clean component interface updateThe component props are properly extended to include the required
client
prop with correct TypeScript typing.
70-70
: LGTM: Consistent prop drillingThe 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 consistencyThe addition of
getClientThirdwebClient
import and the change from relative to absolute path forserverThirdwebClient
improves import consistency across the codebase.
31-31
: LGTM: Appropriate client creation for profile pageCreating 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. TheThirdwebClient
type is properly imported and theclient
prop is correctly typed and passed down to theTeamSettingsSidebar
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
componentThe implementation aligns with the
ProfileHeader
component's updated signature that expects aclient
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
componentThe 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
componentThis aligns with the
ImportModal
component's signature that expects aclient
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 thePartnerForm
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
andDeployViaCLIOrImportCard
). The prop access pattern usingprops.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 tocontract.client
. This improves explicit dependency management and aligns with the broader refactor pattern. TheThirdwebContract
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 theclient
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 theheaderProps
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-levelgetClientThirdwebClient()
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
componentThis 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 theuseThirdwebClient
hook internally.
92-96
: LGTM! Consistent client usage throughout component.The passed
client
prop is correctly used in:
useWalletBalance
hookSendFundsToFaucetModalButton
componentCustomConnectWallet
componentThis 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 includeprops.client
(line 83), ensuring the component re-renders when the client changesThis 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
componentThis 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
callThe 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 theclient
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
andSingleNetworkSelector
) 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
, andloginRedirect
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 aclient
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 theChainIconClient
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 explicitclient
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 theuseThirdwebClient
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:
MismatchButton
→NoFundsDialogContent
→GetFundsFromFaucet
→FaucetButton
. 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 toAllowedOperationsSection
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
andTypedDataRestrictions
components, maintaining consistency in the refactoring approach.Also applies to: 157-161
196-200
: Correct client parameter addition to restriction components.Both
TransactionRestrictions
andTypedDataRestrictions
properly accept theclient
parameter and use it in theirSingleNetworkSelector
components.Also applies to: 327-331
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 -->
6d2fef0
to
a440621
Compare
759d325
to
b84db12
Compare
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
client
prop to multiple components forThirdwebClient
.useThirdwebClient
with directclient
prop usage.client
parameter.Summary by CodeRabbit