-
Notifications
You must be signed in to change notification settings - Fork 13
Reduce compile time #803
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
Reduce compile time #803
Conversation
@GrandSchtroumpf is attempting to deploy a commit to the squirrellabs Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughThis change refactors import statements across numerous files, replacing namespace or wildcard imports with direct named imports of only the required functions, components, or contexts. Corresponding usages within each file are updated to reference these named imports directly, eliminating the need for namespace prefixes. The update also introduces conditional logic in some initialization side effects to prevent certain actions in development environments. No functional logic, control flow, or exported entity signatures are altered; the modifications are strictly limited to import style and usage, enhancing code clarity and maintainability. Changes
Sequence Diagram(s)sequenceDiagram
participant Component
participant Context
participant Utils
Note over Component: On import
Component->>Context: import { NamedContext }
Component->>Utils: import { NeededUtility }
Note over Component: During execution
Component->>Context: useContext(NamedContext)
Component->>Utils: call NeededUtility()
Note over Component: No control flow or logic changes
Possibly related PRs
Suggested reviewers
Poem
Tip ⚡💬 Agentic Chat (Pro Plan, General Availability)
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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 (
|
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
🧹 Nitpick comments (1)
src/components/Create/Create.tsx (1)
56-56
: Removed unused property from hook destructuring.Removed the unused
isPeanutWallet
property from theuseWallet
hook destructuring, which was not being used in this component.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
src/app/favicon.ico
is excluded by!**/*.ico
📒 Files selected for processing (43)
src/app/(mobile-ui)/cashout/status/page.tsx
(1 hunks)src/app/(mobile-ui)/claim/page.tsx
(2 hunks)src/app/(mobile-ui)/link-account/page.tsx
(2 hunks)src/app/global-error.jsx
(1 hunks)src/app/layout.tsx
(2 hunks)src/components/Cashout/Cashout.consts.ts
(2 hunks)src/components/Cashout/CashoutStatus.tsx
(3 hunks)src/components/Cashout/Components/Initial.view.tsx
(3 hunks)src/components/Claim/Claim.tsx
(2 hunks)src/components/Claim/Generic/SenderClaim.view.tsx
(2 hunks)src/components/Claim/Link/Initial.view.tsx
(3 hunks)src/components/Claim/Link/Onchain/Confirm.view.tsx
(8 hunks)src/components/Claim/Link/Onchain/Success.view.tsx
(5 hunks)src/components/Claim/useClaimLink.tsx
(2 hunks)src/components/Create/Components/RecentRecipients.tsx
(2 hunks)src/components/Create/Create.tsx
(2 hunks)src/components/Create/Link/Confirm.view.tsx
(3 hunks)src/components/Create/Link/Initial.view.tsx
(3 hunks)src/components/Create/Link/Input.view.tsx
(2 hunks)src/components/Dashboard/components/MobileComponent.tsx
(3 hunks)src/components/Dashboard/components/OptionsItemComponent.tsx
(3 hunks)src/components/Dashboard/index.tsx
(7 hunks)src/components/Global/AddressLink/index.tsx
(0 hunks)src/components/Global/ChainSelector/index.tsx
(2 hunks)src/components/Global/CopyField/index.tsx
(2 hunks)src/components/Global/GeneralRecipientInput/index.tsx
(2 hunks)src/components/Global/KYCComponent/index.tsx
(8 hunks)src/components/Global/LinkAccountComponent/index.tsx
(5 hunks)src/components/Global/TokenSelector/Components/AdvancedButton.tsx
(4 hunks)src/components/Global/TokenSelector/Components/TokenDisplay.tsx
(2 hunks)src/components/Global/TokenSelector/TokenSelector.tsx
(3 hunks)src/components/LinkAccount/index.tsx
(2 hunks)src/components/Offramp/Confirm.view.tsx
(24 hunks)src/components/Offramp/Success.view.tsx
(3 hunks)src/components/Payment/PaymentForm/index.tsx
(2 hunks)src/components/Profile/Components/TableComponent.tsx
(4 hunks)src/components/Profile/index.tsx
(2 hunks)src/components/Refund/index.tsx
(3 hunks)src/components/Request/Create/Create.consts.ts
(2 hunks)src/components/Request/Create/Views/Initial.view.tsx
(2 hunks)src/components/utils/utils.ts
(2 hunks)src/config/peanut.config.tsx
(2 hunks)src/config/wagmi.config.tsx
(1 hunks)
💤 Files with no reviewable changes (1)
- src/components/Global/AddressLink/index.tsx
🧰 Additional context used
🧠 Learnings (11)
src/components/Global/ChainSelector/index.tsx (2)
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#413
File: src/context/tokenSelector.context.tsx:118-123
Timestamp: 2024-10-08T20:13:42.967Z
Learning: In the `TokenContextProvider` component within `src/context/tokenSelector.context.tsx`, in the TypeScript React application, when data changes and before calling `fetchAndSetTokenPrice`, it is necessary to reset `selectedTokenData`, `selectedTokenPrice`, `selectedTokenDecimals`, and `inputDenomination` to discard stale data.
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#424
File: src/components/Global/TokenSelector/TokenSelector.tsx:197-211
Timestamp: 2024-10-11T01:14:15.489Z
Learning: In `src/components/Global/TokenSelector/TokenSelector.tsx`, when the calculation within functions like `byChainAndText` is not computationally expensive, it's acceptable to avoid using `useCallback` for memoization.
src/components/Claim/Claim.tsx (1)
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#413
File: src/context/tokenSelector.context.tsx:118-123
Timestamp: 2024-10-08T20:13:42.967Z
Learning: In the `TokenContextProvider` component within `src/context/tokenSelector.context.tsx`, in the TypeScript React application, when data changes and before calling `fetchAndSetTokenPrice`, it is necessary to reset `selectedTokenData`, `selectedTokenPrice`, `selectedTokenDecimals`, and `inputDenomination` to discard stale data.
src/components/Create/Link/Confirm.view.tsx (2)
Learnt from: Hugo0
PR: peanutprotocol/peanut-ui#458
File: src/components/Offramp/Confirm.view.tsx:141-141
Timestamp: 2024-10-18T01:51:35.247Z
Learning: The `handleConfirm` function in `src/components/Create/Link/Confirm.view.tsx` is separate from the one in `src/components/Offramp/Confirm.view.tsx` and does not need to be renamed when refactoring `handleConfirm` in `src/components/Offramp/Confirm.view.tsx`.
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#413
File: src/context/tokenSelector.context.tsx:118-123
Timestamp: 2024-10-08T20:13:42.967Z
Learning: In the `TokenContextProvider` component within `src/context/tokenSelector.context.tsx`, in the TypeScript React application, when data changes and before calling `fetchAndSetTokenPrice`, it is necessary to reset `selectedTokenData`, `selectedTokenPrice`, `selectedTokenDecimals`, and `inputDenomination` to discard stale data.
src/components/Create/Link/Input.view.tsx (1)
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#413
File: src/context/tokenSelector.context.tsx:118-123
Timestamp: 2024-10-08T20:13:42.967Z
Learning: In the `TokenContextProvider` component within `src/context/tokenSelector.context.tsx`, in the TypeScript React application, when data changes and before calling `fetchAndSetTokenPrice`, it is necessary to reset `selectedTokenData`, `selectedTokenPrice`, `selectedTokenDecimals`, and `inputDenomination` to discard stale data.
src/components/Cashout/Components/Initial.view.tsx (1)
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#413
File: src/context/tokenSelector.context.tsx:118-123
Timestamp: 2024-10-08T20:13:42.967Z
Learning: In the `TokenContextProvider` component within `src/context/tokenSelector.context.tsx`, in the TypeScript React application, when data changes and before calling `fetchAndSetTokenPrice`, it is necessary to reset `selectedTokenData`, `selectedTokenPrice`, `selectedTokenDecimals`, and `inputDenomination` to discard stale data.
src/components/Global/TokenSelector/TokenSelector.tsx (2)
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#413
File: src/context/tokenSelector.context.tsx:118-123
Timestamp: 2024-10-08T20:13:42.967Z
Learning: In the `TokenContextProvider` component within `src/context/tokenSelector.context.tsx`, in the TypeScript React application, when data changes and before calling `fetchAndSetTokenPrice`, it is necessary to reset `selectedTokenData`, `selectedTokenPrice`, `selectedTokenDecimals`, and `inputDenomination` to discard stale data.
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#631
File: src/components/Create/Create.tsx:108-112
Timestamp: 2025-01-16T13:14:40.363Z
Learning: In the Peanut UI codebase, the `resetTokenContextProvider` function from `tokenSelectorContext` is a stable function reference that doesn't change, so it doesn't need to be included in useEffect dependencies.
src/components/Global/TokenSelector/Components/AdvancedButton.tsx (1)
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#413
File: src/context/tokenSelector.context.tsx:118-123
Timestamp: 2024-10-08T20:13:42.967Z
Learning: In the `TokenContextProvider` component within `src/context/tokenSelector.context.tsx`, in the TypeScript React application, when data changes and before calling `fetchAndSetTokenPrice`, it is necessary to reset `selectedTokenData`, `selectedTokenPrice`, `selectedTokenDecimals`, and `inputDenomination` to discard stale data.
src/components/Payment/PaymentForm/index.tsx (1)
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#413
File: src/context/tokenSelector.context.tsx:118-123
Timestamp: 2024-10-08T20:13:42.967Z
Learning: In the `TokenContextProvider` component within `src/context/tokenSelector.context.tsx`, in the TypeScript React application, when data changes and before calling `fetchAndSetTokenPrice`, it is necessary to reset `selectedTokenData`, `selectedTokenPrice`, `selectedTokenDecimals`, and `inputDenomination` to discard stale data.
src/components/Request/Create/Views/Initial.view.tsx (1)
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#413
File: src/context/tokenSelector.context.tsx:118-123
Timestamp: 2024-10-08T20:13:42.967Z
Learning: In the `TokenContextProvider` component within `src/context/tokenSelector.context.tsx`, in the TypeScript React application, when data changes and before calling `fetchAndSetTokenPrice`, it is necessary to reset `selectedTokenData`, `selectedTokenPrice`, `selectedTokenDecimals`, and `inputDenomination` to discard stale data.
src/components/Create/Create.tsx (1)
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#413
File: src/context/tokenSelector.context.tsx:118-123
Timestamp: 2024-10-08T20:13:42.967Z
Learning: In the `TokenContextProvider` component within `src/context/tokenSelector.context.tsx`, in the TypeScript React application, when data changes and before calling `fetchAndSetTokenPrice`, it is necessary to reset `selectedTokenData`, `selectedTokenPrice`, `selectedTokenDecimals`, and `inputDenomination` to discard stale data.
src/components/Claim/Link/Onchain/Success.view.tsx (1)
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#431
File: src/components/Create/Link/Success.view.tsx:89-89
Timestamp: 2024-10-08T20:29:00.726Z
Learning: `shortenAddressLong` is used for formatting transaction hashes.
🧬 Code Graph Analysis (32)
src/components/utils/utils.ts (1)
src/utils/general.utils.ts (1)
getExplorerUrl
(752-760)
src/components/Global/CopyField/index.tsx (1)
src/utils/general.utils.ts (1)
copyTextToClipboardWithFallback
(390-416)
src/components/Offramp/Success.view.tsx (1)
src/utils/general.utils.ts (2)
getExplorerUrl
(752-760)formatTokenAmount
(312-333)
src/components/Global/TokenSelector/Components/TokenDisplay.tsx (1)
src/utils/general.utils.ts (1)
formatTokenAmount
(312-333)
src/components/Global/ChainSelector/index.tsx (1)
src/context/tokenSelector.context.tsx (1)
tokenSelectorContext
(24-43)
src/components/Claim/Claim.tsx (1)
src/context/tokenSelector.context.tsx (1)
tokenSelectorContext
(24-43)
src/app/(mobile-ui)/link-account/page.tsx (1)
src/components/LinkAccount/index.tsx (1)
LinkAccountComponent
(14-82)
src/app/(mobile-ui)/claim/page.tsx (1)
src/utils/general.utils.ts (1)
formatAmount
(259-299)
src/components/Create/Link/Confirm.view.tsx (1)
src/context/tokenSelector.context.tsx (1)
tokenSelectorContext
(24-43)
src/components/Dashboard/components/MobileComponent.tsx (1)
src/utils/general.utils.ts (3)
formatDate
(832-841)formatTokenAmount
(312-333)copyTextToClipboardWithFallback
(390-416)
src/components/Claim/useClaimLink.tsx (2)
src/hooks/wallet/useWallet.ts (1)
useWallet
(89-399)src/utils/general.utils.ts (1)
isTestnetChain
(418-424)
src/components/Cashout/Components/Initial.view.tsx (1)
src/context/tokenSelector.context.tsx (1)
tokenSelectorContext
(24-43)
src/components/Global/TokenSelector/TokenSelector.tsx (1)
src/context/tokenSelector.context.tsx (1)
tokenSelectorContext
(24-43)
src/components/Global/TokenSelector/Components/AdvancedButton.tsx (2)
src/context/tokenSelector.context.tsx (1)
tokenSelectorContext
(24-43)src/utils/general.utils.ts (1)
formatTokenAmount
(312-333)
src/components/Global/LinkAccountComponent/index.tsx (2)
src/utils/cashout.utils.ts (5)
validateBankAccount
(532-549)getCustomer
(195-199)getThreeCharCountryCodeFromIban
(491-504)createExternalAccount
(232-313)createAccount
(89-118)src/interfaces/interfaces.ts (1)
IResponse
(6-17)
src/config/peanut.config.tsx (1)
src/config/wagmi.config.tsx (1)
ContextProvider
(65-82)
src/components/Refund/index.tsx (1)
src/utils/general.utils.ts (1)
getExplorerUrl
(752-760)
src/components/Dashboard/index.tsx (4)
src/utils/general.utils.ts (5)
getAllLinksFromLocalStorage
(132-166)getAllRaffleLinksFromLocalstorage
(168-243)printableAddress
(64-67)formatTokenAmount
(312-333)formatDate
(832-841)src/components/Dashboard/components/SortComponent.tsx (1)
SortComponent
(4-45)src/components/Dashboard/components/OptionsItemComponent.tsx (1)
OptionsItemComponent
(6-72)src/components/Dashboard/components/MobileComponent.tsx (1)
MobileItemComponent
(8-102)
src/components/Claim/Link/Initial.view.tsx (1)
src/context/tokenSelector.context.tsx (1)
tokenSelectorContext
(24-43)
src/app/(mobile-ui)/cashout/status/page.tsx (2)
src/app/(mobile-ui)/claim/page.tsx (1)
dynamic
(6-6)src/components/Cashout/CashoutStatus.tsx (1)
CashoutStatus
(12-79)
src/components/Payment/PaymentForm/index.tsx (1)
src/context/tokenSelector.context.tsx (1)
tokenSelectorContext
(24-43)
src/components/Global/KYCComponent/index.tsx (1)
src/utils/cashout.utils.ts (4)
getUserLinks
(153-186)awaitStatusCompletion
(207-230)convertPersonaUrl
(24-36)getStatus
(188-193)
src/components/Create/Components/RecentRecipients.tsx (1)
src/utils/general.utils.ts (1)
shortenAddressLong
(55-62)
src/components/Global/GeneralRecipientInput/index.tsx (2)
src/utils/cashout.utils.ts (1)
validateBankAccount
(532-549)src/utils/general.utils.ts (2)
validateEnsName
(77-79)resolveFromEnsName
(361-388)
src/components/Request/Create/Views/Initial.view.tsx (1)
src/context/tokenSelector.context.tsx (1)
tokenSelectorContext
(24-43)
src/components/Create/Create.tsx (2)
src/hooks/wallet/useWallet.ts (1)
useWallet
(89-399)src/context/tokenSelector.context.tsx (1)
tokenSelectorContext
(24-43)
src/components/Cashout/CashoutStatus.tsx (1)
src/utils/cashout.utils.ts (3)
CashoutTransaction
(634-649)getCashoutStatus
(669-694)CashoutStatusDescriptions
(651-667)
src/components/Offramp/Confirm.view.tsx (4)
src/context/tokenSelector.context.tsx (1)
tokenSelectorContext
(24-43)src/utils/general.utils.ts (5)
isNativeCurrency
(441-445)saveOfframpLinkToLocalstorage
(477-499)isTestnetChain
(418-424)formatTokenAmount
(312-333)formatAmount
(259-299)src/utils/cashout.utils.ts (8)
getLiquidationAddresses
(474-489)getChainIdFromBridgeChainName
(527-530)getTokenAddressFromBridgeTokenName
(520-526)getBridgeTokenName
(506-513)getBridgeChainName
(515-518)createLiquidationAddress
(366-472)fetchRouteRaw
(696-725)submitCashoutLink
(569-615)src/utils/sdkErrorHandler.utils.tsx (1)
ErrorHandler
(9-114)
src/app/layout.tsx (2)
src/config/wagmi.config.tsx (1)
ContextProvider
(65-82)src/components/Global/TranslationSafeWrapper.tsx (1)
TranslationSafeWrapper
(8-18)
src/components/Dashboard/components/OptionsItemComponent.tsx (1)
src/utils/general.utils.ts (1)
copyTextToClipboardWithFallback
(390-416)
src/components/Create/Link/Initial.view.tsx (1)
src/utils/general.utils.ts (2)
isNumeric
(789-792)resolveFromEnsName
(361-388)
src/components/Profile/Components/TableComponent.tsx (1)
src/utils/general.utils.ts (4)
formatTokenAmount
(312-333)formatDate
(832-841)getExplorerUrl
(752-760)copyTextToClipboardWithFallback
(390-416)
🔇 Additional comments (61)
src/app/(mobile-ui)/cashout/status/page.tsx (1)
1-1
: LGTM: Improved import specificityThe change from namespace imports to named imports for the
CashoutStatus
component improves code clarity and helps reduce compile time by being more explicit about what's being imported.Also applies to: 8-8
src/components/Global/TokenSelector/Components/TokenDisplay.tsx (1)
2-2
: LGTM: Replaced wildcard import with specific utility importThe change from importing the entire utils namespace to only importing the specific
formatTokenAmount
function aligns with the PR objective to reduce compile time and improves code clarity.Also applies to: 30-36
src/components/Request/Create/Create.consts.ts (1)
2-2
: LGTM: Direct imports for view componentsReplacing the wildcard import with specific named imports for
InitialView
andCreateRequestSuccessView
improves code clarity and helps reduce compile time by being explicit about dependencies.Also applies to: 18-18, 20-20
src/components/Create/Components/RecentRecipients.tsx (1)
2-2
: LGTM: Specific utility function importThe change from importing the entire utils namespace to only importing the specific
shortenAddressLong
function aligns with the PR objective and makes dependencies clearer.Also applies to: 49-49
src/components/Create/Link/Input.view.tsx (1)
16-16
: LGTM: Direct context importsReplacing the context namespace import with specific named imports for
tokenSelectorContext
andloadingStateContext
improves code readability and helps reduce compile time by being explicit about which contexts are actually used.Also applies to: 76-76, 81-81
src/components/Claim/Claim.tsx (2)
8-8
: Import refactoring looks good!Replacing the wildcard import with a named import for
tokenSelectorContext
is a good change that aligns with the PR objective of reducing compile time.
47-47
: Usage updated correctly.The usage of
tokenSelectorContext
has been properly updated to match the import change.src/app/global-error.jsx (1)
8-12
: Good optimization for development environment.Conditionally executing Sentry error reporting only in non-development environments is a good practice. It prevents development errors from cluttering the Sentry dashboard and reduces unnecessary API calls during local development.
src/app/(mobile-ui)/claim/page.tsx (2)
2-2
: Import refactoring looks good!Replacing the wildcard import with a specific named import for
formatAmount
aligns with the PR objective of reducing compile time.
46-46
: Usage updated correctly.The direct usage of
formatAmount
has been properly updated to match the import change.src/components/utils/utils.ts (2)
2-2
: Import refactoring looks good!Replacing the wildcard import with a specific named import for
getExplorerUrl
aligns with the PR objective of reducing compile time.
93-93
: Usage updated correctly.The direct usage of
getExplorerUrl
has been properly updated to match the import change.src/components/Request/Create/Views/Initial.view.tsx (1)
11-11
: Refactor to named context imports is correct and improves clarity.Switching from wildcard to named imports for contexts is a best practice for performance and maintainability. All usages are correctly updated.
Also applies to: 45-46
src/components/Payment/PaymentForm/index.tsx (1)
21-21
: Direct context import and usage refactor is correct.Switching to a named import for
tokenSelectorContext
and updating its usage is correct and improves code clarity.Also applies to: 72-72
src/components/Cashout/Cashout.consts.ts (1)
6-6
: Direct component import and usage refactor is correct.Switching to a named import for
InitialCashoutView
and updating its usage in the screen map is correct and improves code clarity.Also applies to: 24-24
src/components/Global/GeneralRecipientInput/index.tsx (1)
5-5
: Selective utility imports and usage refactor are correct.Switching to named imports for utility functions and updating their usage is correct and improves code clarity and performance.
Also applies to: 51-52, 58-58
src/app/(mobile-ui)/link-account/page.tsx (1)
1-1
: Direct component import and usage refactor is correct.Switching to a named import for
LinkAccountComponent
and updating its usage is correct and improves code clarity.Also applies to: 23-23
src/components/LinkAccount/index.tsx (1)
4-4
: Good refactoring to use specific imports.The change from wildcard import to named import for the context improves code clarity and potentially reduces bundle size by explicitly importing only what's needed.
Also applies to: 20-20
src/components/Offramp/Success.view.tsx (1)
5-5
: Well-executed refactoring of utility imports.Replacing the namespace import with specific named imports for
formatTokenAmount
andgetExplorerUrl
functions improves code clarity and aligns with the PR objective of removing wildcard imports.Also applies to: 33-33, 87-87, 90-90, 94-94, 97-97, 102-102
src/components/Global/TokenSelector/TokenSelector.tsx (1)
4-4
: Good implementation of specific context import.Converting from a namespace import to a specific named import for
tokenSelectorContext
improves code readability and contributes to better module bundling.Also applies to: 23-23, 186-186
src/components/Global/ChainSelector/index.tsx (1)
4-4
: Clean refactoring of context import.The change from wildcard import to direct named import for
tokenSelectorContext
follows the pattern established throughout the codebase, maintaining consistency while improving specificity.Also applies to: 32-32
src/components/Global/CopyField/index.tsx (1)
4-4
: Refactor to direct named import is correct and improves clarity.Switching from namespace to named import for
copyTextToClipboardWithFallback
is a best practice and reduces unnecessary import scope. Usage is correct and safe.Also applies to: 27-27
src/components/Create/Link/Confirm.view.tsx (1)
12-12
: Direct named context imports improve clarity and maintainability.Switching from namespace to named imports for contexts is a best practice and reduces unnecessary import scope. Usage is correct and safe.
Also applies to: 58-58, 75-75
src/components/Profile/index.tsx (1)
3-3
: Direct named context import is correct and improves clarity.Switching from namespace to named import for
loadingStateContext
is a best practice and reduces unnecessary import scope. Usage is correct and safe.Also applies to: 20-20
src/components/Claim/Link/Initial.view.tsx (1)
23-23
: Direct named context imports improve clarity and maintainability.Switching from namespace to named imports for contexts is a best practice and reduces unnecessary import scope. Usage is correct and safe.
Also applies to: 88-88, 99-99
src/components/Dashboard/components/OptionsItemComponent.tsx (1)
3-3
: Refactor to direct named import is correct and improves clarity.Switching from namespace to named import for
copyTextToClipboardWithFallback
is a best practice and reduces unnecessary import scope. Usage is correct and safe.Also applies to: 39-39, 61-61
src/components/Cashout/Components/Initial.view.tsx (1)
14-14
: Import refactoring improves clarity and compile timeThe replacement of namespace imports with direct named imports (
tokenSelectorContext
andloadingStateContext
) aligns with the PR's objective to improve compile time. This change makes it more explicit which specific components are being used from the context module.Also applies to: 47-47, 66-66
src/components/Claim/Generic/SenderClaim.view.tsx (1)
5-5
: Clean import refactoring removes unnecessary dependenciesThe change from namespace imports to specific named imports improves code clarity and should help reduce compile time by eliminating the unused
shortenAddress
utility that was previously imported as part of the namespace.Also applies to: 8-8, 31-31
src/components/Claim/useClaimLink.tsx (1)
10-10
: Clean import refactoring for context and utility functionsGood job refactoring the imports from namespace imports to named imports for both the
loadingStateContext
andisTestnetChain
utility. This change makes the dependencies more explicit and should help reduce compile time.Also applies to: 12-12, 19-19, 57-57
src/components/Dashboard/components/MobileComponent.tsx (1)
4-4
: Import refactoring simplifies utility function usageThe change from namespace imports to named imports for the utility functions (
copyTextToClipboardWithFallback
,formatDate
, andformatTokenAmount
) improves code readability and should help with tree-shaking during compilation.Also applies to: 38-38, 44-44, 83-83
src/config/wagmi.config.tsx (1)
65-65
:❓ Verification inconclusive
Made cookies parameter optional in ContextProvider
Making the
cookies
parameter optional improves flexibility when using theContextProvider
component. However, ensure that thecookieToInitialState
function properly handles undefined or null values for the cookies parameter.
🏁 Script executed:
#!/bin/bash # Description: Check if cookieToInitialState handles undefined/null cookies gracefully # Search for cookieToInitialState implementation or its usages in the codebase rg -A 5 "cookieToInitialState" --type ts --type tsxLength of output: 79
I'll generate a revised shell script command to search for the
cookieToInitialState
implementation without the file-type filters. This will allow us to inspect its handling of undefined/null cookies.Please run this script and share the output so we can verify whether
cookieToInitialState
gracefully handles undefined or null values. Once we have that information, we can update the review comment accordingly.
🏁 Script executed:
#!/bin/bash # Re-run search for the cookieToInitialState implementation without file type restrictions. rg -A 5 "cookieToInitialState" .Length of output: 889
ContextProvider: Verify External Handling of Optional Cookies
- The
cookies
parameter inContextProvider
has been made optional, enhancing flexibility.- In
src/config/wagmi.config.tsx
, thecookieToInitialState
function from the externalwagmi
package is invoked withcookies
, which may beundefined
ornull
.- Since the implementation of
cookieToInitialState
isn’t directly visible in the codebase, please manually verify (or consult thewagmi
documentation/tests) that it gracefully handles cases wherecookies
is absent or set tonull
.src/components/Refund/index.tsx (1)
7-7
: Improved import specificity for better compile time.The code now imports specific functions and contexts directly instead of using wildcard imports. This change is part of the broader effort to reduce compilation time as outlined in the PR objectives.
Using named imports instead of namespace imports has benefits:
- Better tree-shaking: The bundler can exclude unused code
- Improved IDE support for code navigation and auto-completion
- Clearer dependency tracking
Also applies to: 9-9, 32-32, 109-109
src/components/Global/KYCComponent/index.tsx (1)
11-11
: Streamlined imports for KYC component utilities.The code now properly imports the specific utility functions needed instead of importing the entire utils namespace. This is aligned with the PR objective to improve compilation time by eliminating wildcard imports.
The refactored imports (awaitStatusCompletion, convertPersonaUrl, getStatus, getUserLinks) are now accessed directly rather than through the utils namespace, maintaining identical functionality while improving build performance.
Also applies to: 112-115, 172-175, 194-203, 283-283, 295-304, 320-320
src/config/peanut.config.tsx (2)
2-2
: Narrowed imports for wagmi config context provider.Replaced namespace import with specific named import for ContextProvider, improving build performance while maintaining the same functionality.
Also applies to: 31-31, 34-34
18-25
: Added environment check for initialization.Added conditional to skip initialization in development mode, which can improve development performance by avoiding unnecessary initialization of analytics and other production-focused services.
This is a nice optimization that keeps development builds cleaner and potentially faster, while ensuring production builds still initialize all necessary services.
src/components/Profile/Components/TableComponent.tsx (1)
7-7
: Enhanced import specificity for table component utilities.Replaced broad utility namespace import with targeted imports of specific functions (copyTextToClipboardWithFallback, formatDate, formatTokenAmount, getExplorerUrl), allowing for better tree-shaking and reduced compile time.
All function references throughout the component have been updated to access these utilities directly rather than through the utils namespace prefix, maintaining identical functionality.
Also applies to: 103-103, 107-107, 159-159, 172-172
src/components/Global/LinkAccountComponent/index.tsx (2)
8-8
: Improved import efficiency with named imports.The change from wildcard import (
import * as utils from '@/utils'
) to specific named imports improves bundle size efficiency through better tree-shaking.
160-160
: Properly updated utility function references.All references to utility functions throughout the component have been correctly updated to use the directly imported functions instead of accessing them through the
utils
namespace.Also applies to: 206-207, 299-300, 307-313, 339-346
src/components/Global/TokenSelector/Components/AdvancedButton.tsx (3)
1-2
: Improved import specificity for context and utilities.Replaced wildcard imports with named imports for better tree-shaking and compile-time performance.
40-40
: Updated context usage to reflect import change.The context reference is correctly updated to use the directly imported
tokenSelectorContext
.
96-96
: Properly updated utility function references.All references to
formatTokenAmount
have been correctly changed to use the directly imported function instead of accessing it through theutils
namespace.Also applies to: 105-105, 107-107, 112-112
src/components/Create/Create.tsx (2)
6-6
: Improved import specificity for token selector context.Changed from wildcard import to named import, making the code more maintainable and efficient.
58-58
: Updated context usage to reflect import change.The
resetTokenContextProvider
is now correctly accessed from the directly imported context rather than through a namespace.src/components/Claim/Link/Onchain/Success.view.tsx (3)
3-3
: Improved import specificity for contexts and utilities.Replaced wildcard imports with named imports for better bundle size efficiency and clearer code.
Also applies to: 5-5
17-17
: Updated context usage to reflect import change.The context reference is correctly updated to use the directly imported
tokenSelectorContext
.
20-20
: Properly updated utility function references.All references to
getExplorerUrl
andshortenAddressLong
have been correctly changed to use the directly imported functions instead of accessing them through theutils
namespace.Also applies to: 72-72, 79-80, 91-92, 100-100
src/components/Dashboard/index.tsx (3)
12-12
: Good refactoring from wildcard to named importsThis change improves compile time by explicitly importing only the specific utility functions needed from the
@/utils
module instead of importing the entire namespace. Named imports enable better tree-shaking, which helps reduce bundle size.
14-14
: Good practice using named component importsConverting from wildcard imports to specific named imports for components improves code readability and enables better tree-shaking by the bundler.
54-55
: Correctly updated utility references to match import styleAll references to utility functions and components have been properly updated to use the direct imports rather than accessing them through namespaces (e.g.,
formatDate
instead ofutils.formatDate
), maintaining consistent usage throughout the file.Also applies to: 60-61, 122-122, 189-189, 192-192, 225-225, 236-236
src/app/layout.tsx (2)
2-3
: Good practice using named provider importsImporting specific provider components directly instead of using wildcard imports improves compile time and enables better tree-shaking.
65-69
: Correctly updated component usage to match import styleThe component references in the JSX structure have been properly updated to use the direct imports, maintaining the same component hierarchy and functionality.
src/components/Cashout/CashoutStatus.tsx (2)
3-3
: Good refactoring to named imports for cashout utilitiesConverting from wildcard imports to specific named imports for cashout utilities and types improves code clarity and helps with compile time.
14-14
: Correctly updated cashout utility referencesAll references to cashout utilities and types (CashoutTransaction type, getCashoutStatus function, and CashoutStatusDescriptions object) have been properly updated to use the direct imports rather than accessing them through the utils namespace.
Also applies to: 18-18, 44-44
src/components/Claim/Link/Onchain/Confirm.view.tsx (3)
9-9
: Good practice using named context importsDirectly importing specific contexts instead of using wildcard imports improves code clarity and enables better tree-shaking.
11-11
: Good refactoring to named imports for utility functionsConverting from wildcard imports to specific named imports for utility functions improves compile time and code readability.
32-32
: Correctly updated utility and context referencesAll references to contexts and utility functions have been properly updated to use the direct imports rather than accessing them through namespaces. This includes context usage with useContext as well as function calls throughout the component.
Also applies to: 34-34, 70-71, 89-89, 124-124, 135-135, 139-139, 166-168, 177-177
src/components/Offramp/Confirm.view.tsx (3)
14-16
: Improved import specificity enhances build optimization.The change from wildcard imports to named imports is a good practice that will help reduce compile time and improve tree-shaking. This makes dependencies more explicit and helps the bundler eliminate unused code.
69-69
: Context usage updated to match new import pattern.Correctly updated context access to match the named imports pattern, maintaining consistent usage throughout the file.
Also applies to: 81-81
124-124
: Utility function usage updated consistently throughout the file.All utility function references have been correctly updated to use the direct imports rather than accessing them through a namespace. This change is consistent throughout this large component, which is excellent for maintainability.
Also applies to: 153-153, 199-201, 270-272, 294-301, 311-318, 358-366, 383-385, 504-521, 523-533, 547-547, 570-573, 601-602, 614-622, 641-642, 664-664, 673-680, 682-683, 701-718, 936-936, 960-960, 963-966, 973-973
src/components/Create/Link/Initial.view.tsx (2)
5-5
: Refined imports improve code organization.Good refactoring from namespace imports to specific named imports:
- Direct import of
isNumeric
from validator- Specific import of
loadingStateContext
- Direct import of
resolveFromEnsName
utility- More targeted import of just the
utils
namespace from ethersThese changes align with the PR's goal of reducing compile time by making imports more explicit.
Also applies to: 13-15
34-34
: Updated references to match new import pattern.All references to imported modules have been properly updated to use the directly imported functions and objects. The changes maintain the same functionality while improving code clarity.
Also applies to: 42-42, 46-46, 120-120
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.
thanks for the pr @GrandSchtroumpf
one blocking change, can you fix the merge conflicts, two files were deleted and they are now conflicting in this pr, thank you
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
7e443a7
into
peanutprotocol:peanut-wallet-dev
DONE:
@/components
,@/Views
,@/configs
,@/utils
&@/context
Summary by CodeRabbit
Refactor
Chores
Bug Fixes