refactor: converts ChainParamContext to hook#2403
Conversation
WalkthroughAuth components were converted to explicit dependency injection (exporting DEPENDENCIES and accepting a dependencies prop); router wiring moved from the service container to injected hooks/useRouter; ChainParamProvider was removed and replaced by a standalone useChainParam hook with tests; ServicesProvider and tests updated to match DI changes. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2403 +/- ##
==========================================
- Coverage 51.17% 50.90% -0.28%
==========================================
Files 1072 1061 -11
Lines 29246 28903 -343
Branches 6434 6385 -49
==========================================
- Hits 14968 14714 -254
+ Misses 13864 13841 -23
+ Partials 414 348 -66
*This pull request uses carry forward flags. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
apps/deploy-web/src/hooks/useLoginRequiredEventHandler.tsx (1)
15-46: Critical: Missing dependencies in useCallback array.The
useCallbackhook on line 15 returns a function that referencesrouterandurlService(used on lines 28 and 36), but these dependencies are not included in the dependency array on line 45. This violates React's Rules of Hooks and can lead to stale closures where the callback uses outdated values.🔎 Proposed fix
return user?.userId ? handler : preventer; }, - [user?.userId, requireAction] + [user?.userId, requireAction, router, urlService] );apps/deploy-web/src/components/auth/AuthPage/AuthPage.tsx (1)
51-57: MissingauthServicein dependency array.The
redirectToSocialLogincallback usesauthService.loginViaOauthbutauthServiceis not included in the dependency array.🔎 Proposed fix
const redirectToSocialLogin = useCallback( async (provider: "github" | "google-oauth2") => { const returnUrl = searchParams.get("from") || searchParams.get("returnTo") || "/"; await authService.loginViaOauth({ returnTo: returnUrl, connection: provider }); }, - [searchParams] + [searchParams, authService] );
🧹 Nitpick comments (5)
apps/deploy-web/tests/unit/mocks.tsx (1)
12-12: Redundant type check and verify hook mocking behavior.The
typeof name === "string"check is redundant sinceObject.keys()always returns an array of strings.Additionally, hooks mocked with
jest.fn(undefined)will returnundefinedby default. Verify that all hooks used in tests work correctly with this default behavior, as some hooks may need to return specific objects or values to avoid test failures.🔎 Simplified version without redundant check
- all[name] = overrides?.[name] || (jest.fn(typeof name === "string" && name.startsWith("use") ? undefined : ComponentMock) as T[keyof T]); + all[name] = overrides?.[name] || (jest.fn(name.startsWith("use") ? undefined : ComponentMock) as T[keyof T]);apps/deploy-web/src/queries/useSaveSettings.ts (1)
48-49: LGTM: Valid caching configuration.The 1-hour caching for deposit parameters is appropriate given they're infrequently-changing blockchain parameters.
Consider setting
gcTimelonger thanstaleTime(e.g., 2-3 hours) to retain cache during background refetches, though the current equal-value configuration is valid.Optional: Extend gcTime for better cache retention
staleTime: ONE_HOUR_IN_MS, - gcTime: ONE_HOUR_IN_MS, + gcTime: ONE_HOUR_IN_MS * 2, // Retain cache longer for background refetchesapps/deploy-web/src/hooks/useBackNav.ts (1)
10-16: Consider usingrouterobject directly in dependencies.Using
router.asPathcauses the callback to be recreated on every navigation, even thoughrouter.back()androuter.push()methods remain stable. Therouterobject fromuseRouter()is stable across renders in Next.js.🔎 Suggested change
return useCallback(() => { if (windowHistory.length > 1) { router.back(); } else { router.push(fallback); } - }, [router.asPath, windowHistory, fallback]); + }, [router, windowHistory, fallback]); };apps/deploy-web/src/components/auth/SignInForm/SignInForm.tsx (1)
18-36: Consider moving DEPENDENCIES before Props for clarity.The
Propsinterface referencestypeof DEPENDENCIESon line 24, butDEPENDENCIESis defined afterPropson lines 27-36. While this works due to TypeScript's hoisting behavior, placingDEPENDENCIESbeforePropswould improve readability.🔎 Suggested reordering
export type SignInFormValues = z.infer<typeof formSchema>; +export const DEPENDENCIES = { + Button, + Form, + FormField, + FormInput, + Spinner, + Link, + useBackNav, + useForm +}; + interface Props { isLoading?: boolean; onSubmit: (values: SignInFormValues) => void; onForgotPasswordClick?: () => void; defaultEmail?: string; onEmailChange?: (email: string) => void; dependencies?: typeof DEPENDENCIES; } -export const DEPENDENCIES = { - Button, - Form, - FormField, - FormInput, - Spinner, - Link, - useBackNav, - useForm -}; - export function SignInForm({ dependencies: d = DEPENDENCIES, ...props }: Props) {apps/deploy-web/src/hooks/useChainParam/useChainParam.tsx (1)
15-17: Consider renamingContextTypesince this is now a hook.Since this was refactored from a context to a hook, the type name
ContextTypeis now slightly misleading. A name likeChainParamResultor simply export the type inline would better reflect the current pattern.
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (23)
apps/deploy-web/src/components/auth/AuthPage/AuthPage.spec.tsx(1 hunks)apps/deploy-web/src/components/auth/AuthPage/AuthPage.tsx(2 hunks)apps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsx(3 hunks)apps/deploy-web/src/components/auth/SignInForm/SignInForm.tsx(4 hunks)apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsx(2 hunks)apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.tsx(1 hunks)apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsx(3 hunks)apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.tsx(3 hunks)apps/deploy-web/src/components/get-started/GetStartedStepper.tsx(1 hunks)apps/deploy-web/src/components/sdl/DeploymentMinimumEscrowAlertText.tsx(1 hunks)apps/deploy-web/src/components/shared/PrerequisiteList.tsx(1 hunks)apps/deploy-web/src/context/ChainParamProvider/ChainParamProvider.tsx(0 hunks)apps/deploy-web/src/context/ChainParamProvider/index.ts(0 hunks)apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx(4 hunks)apps/deploy-web/src/hooks/useBackNav.ts(1 hunks)apps/deploy-web/src/hooks/useChainParam/useChainParam.spec.tsx(1 hunks)apps/deploy-web/src/hooks/useChainParam/useChainParam.tsx(1 hunks)apps/deploy-web/src/hooks/useLoginRequiredEventHandler.tsx(1 hunks)apps/deploy-web/src/hooks/useManagedEscrowFaqModal.tsx(1 hunks)apps/deploy-web/src/hooks/useWalletBalance.ts(1 hunks)apps/deploy-web/src/pages/_app.tsx(1 hunks)apps/deploy-web/src/queries/useSaveSettings.ts(1 hunks)apps/deploy-web/tests/unit/mocks.tsx(1 hunks)
💤 Files with no reviewable changes (2)
- apps/deploy-web/src/context/ChainParamProvider/index.ts
- apps/deploy-web/src/context/ChainParamProvider/ChainParamProvider.tsx
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/*.{ts,tsx,js}: Never use typeanyor cast to typeany. Always define the proper TypeScript types.
Never use deprecated methods from libraries.
Don't add unnecessary comments to the code.
Files:
apps/deploy-web/src/components/get-started/GetStartedStepper.tsxapps/deploy-web/src/queries/useSaveSettings.tsapps/deploy-web/src/components/sdl/DeploymentMinimumEscrowAlertText.tsxapps/deploy-web/src/hooks/useWalletBalance.tsapps/deploy-web/src/hooks/useManagedEscrowFaqModal.tsxapps/deploy-web/src/hooks/useBackNav.tsapps/deploy-web/tests/unit/mocks.tsxapps/deploy-web/src/components/shared/PrerequisiteList.tsxapps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsxapps/deploy-web/src/hooks/useChainParam/useChainParam.tsxapps/deploy-web/src/pages/_app.tsxapps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsxapps/deploy-web/src/components/auth/SignInForm/SignInForm.tsxapps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsxapps/deploy-web/src/hooks/useChainParam/useChainParam.spec.tsxapps/deploy-web/src/components/auth/AuthPage/AuthPage.spec.tsxapps/deploy-web/src/components/auth/SignUpForm/SignUpForm.tsxapps/deploy-web/src/hooks/useLoginRequiredEventHandler.tsxapps/deploy-web/src/components/auth/AuthPage/AuthPage.tsxapps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsxapps/deploy-web/src/components/auth/SignUpButton/SignUpButton.tsx
**/*.spec.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/no-jest-mock.mdc)
Don't use
jest.mock()in test files. Instead, usejest-mock-extendedto create mocks and pass mocks as dependencies to the service under testUse
setupfunction instead ofbeforeEachin test files. Thesetupfunction must be at the bottom of the rootdescribeblock, should create an object under test and return it, accept a single parameter with inline type definition, avoid shared state, and not have a specified return type.
**/*.spec.{ts,tsx}: Use<Subject>.namein the root describe suite description instead of hardcoded class/service name strings to enable automated refactoring tools to find all references
Use either a method name or a condition starting with 'when' for nested suite descriptions in tests
Use present simple, 3rd person singular for test descriptions without prepending 'should'
Files:
apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsxapps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsxapps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsxapps/deploy-web/src/hooks/useChainParam/useChainParam.spec.tsxapps/deploy-web/src/components/auth/AuthPage/AuthPage.spec.tsx
{apps/deploy-web,apps/provider-console}/**/*.spec.tsx
📄 CodeRabbit inference engine (.cursor/rules/query-by-in-tests.mdc)
Use
queryBymethods instead ofgetBymethods in test expectations
Files:
apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsxapps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsxapps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsxapps/deploy-web/src/hooks/useChainParam/useChainParam.spec.tsxapps/deploy-web/src/components/auth/AuthPage/AuthPage.spec.tsx
🧠 Learnings (10)
📚 Learning: 2025-06-05T21:07:51.985Z
Learnt from: baktun14
Repo: akash-network/console PR: 1432
File: apps/deploy-web/src/components/deployments/DeploymentAlerts/DeploymentCloseAlert.tsx:38-38
Timestamp: 2025-06-05T21:07:51.985Z
Learning: The ContactPointSelect component in apps/deploy-web/src/components/alerts/ContactPointSelectForm/ContactPointSelect.tsx uses the useFormContext hook internally to connect to React Hook Form, so it doesn't need to be wrapped in a FormField component.
Applied to files:
apps/deploy-web/src/components/sdl/DeploymentMinimumEscrowAlertText.tsxapps/deploy-web/src/components/auth/SignInForm/SignInForm.tsxapps/deploy-web/src/components/auth/SignUpForm/SignUpForm.tsx
📚 Learning: 2025-11-25T17:45:44.790Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/no-jest-mock.mdc:0-0
Timestamp: 2025-11-25T17:45:44.790Z
Learning: Applies to **/*.spec.{ts,tsx} : Don't use `jest.mock()` in test files. Instead, use `jest-mock-extended` to create mocks and pass mocks as dependencies to the service under test
Applied to files:
apps/deploy-web/tests/unit/mocks.tsxapps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsxapps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsxapps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsxapps/deploy-web/src/components/auth/AuthPage/AuthPage.spec.tsx
📚 Learning: 2025-11-19T15:15:07.283Z
Learnt from: ygrishajev
Repo: akash-network/console PR: 2254
File: apps/api/test/functional/sign-and-broadcast-tx.spec.ts:4-4
Timestamp: 2025-11-19T15:15:07.283Z
Learning: In the Akash Network Console project, when tests use native Node.js fetch (available in Node 18+), fetch-mock should be used for HTTP mocking instead of nock, as nock does not support intercepting native fetch calls. This applies to apps/api/test/functional/sign-and-broadcast-tx.spec.ts and any other tests using native fetch.
Applied to files:
apps/deploy-web/tests/unit/mocks.tsx
📚 Learning: 2025-11-25T17:45:49.180Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-11-25T17:45:49.180Z
Learning: Applies to {apps/deploy-web,apps/provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations
Applied to files:
apps/deploy-web/tests/unit/mocks.tsxapps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsxapps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsxapps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsxapps/deploy-web/src/hooks/useChainParam/useChainParam.spec.tsxapps/deploy-web/src/components/auth/AuthPage/AuthPage.spec.tsx
📚 Learning: 2025-11-25T17:45:58.258Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/test-descriptions.mdc:0-0
Timestamp: 2025-11-25T17:45:58.258Z
Learning: Applies to **/*.spec.{ts,tsx} : Use `<Subject>.name` in the root describe suite description instead of hardcoded class/service name strings to enable automated refactoring tools to find all references
Applied to files:
apps/deploy-web/tests/unit/mocks.tsxapps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsx
📚 Learning: 2025-11-25T17:45:52.965Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-11-25T17:45:52.965Z
Learning: Applies to **/*.spec.{ts,tsx} : Use `setup` function instead of `beforeEach` in test files. The `setup` function must be at the bottom of the root `describe` block, should create an object under test and return it, accept a single parameter with inline type definition, avoid shared state, and not have a specified return type.
Applied to files:
apps/deploy-web/tests/unit/mocks.tsxapps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsxapps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsxapps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsxapps/deploy-web/src/hooks/useChainParam/useChainParam.spec.tsxapps/deploy-web/src/components/auth/AuthPage/AuthPage.spec.tsx
📚 Learning: 2025-07-11T10:46:43.711Z
Learnt from: stalniy
Repo: akash-network/console PR: 1660
File: apps/deploy-web/src/components/alerts/DeploymentAlertsContainer/DeploymentAlertsContainer.spec.tsx:54-56
Timestamp: 2025-07-11T10:46:43.711Z
Learning: In apps/{deploy-web,provider-console}/**/*.spec.tsx files: Use `getBy` methods instead of `queryBy` methods when testing element presence with `toBeInTheDocument()` because `getBy` throws an error and shows DOM state when element is not found, providing better debugging information than `queryBy` which returns null.
Applied to files:
apps/deploy-web/tests/unit/mocks.tsxapps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsxapps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsxapps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsxapps/deploy-web/src/components/auth/AuthPage/AuthPage.spec.tsx
📚 Learning: 2025-11-25T17:45:39.561Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-11-25T17:45:39.561Z
Learning: Applies to **/*.{ts,tsx,js} : Never use deprecated methods from libraries.
Applied to files:
apps/deploy-web/src/components/shared/PrerequisiteList.tsx
📚 Learning: 2025-07-29T15:14:53.419Z
Learnt from: baktun14
Repo: akash-network/console PR: 1750
File: apps/deploy-web/src/components/onboarding/steps/PaymentVerificationCard/PaymentVerificationCard.tsx:33-37
Timestamp: 2025-07-29T15:14:53.419Z
Learning: CardDescription from akashnetwork/ui/components renders as a <p> element, so any block-level content inside it should use <div> (not <p>) to avoid invalid HTML nesting.
Applied to files:
apps/deploy-web/src/components/shared/PrerequisiteList.tsx
📚 Learning: 2025-06-19T16:00:05.428Z
Learnt from: ygrishajev
Repo: akash-network/console PR: 1512
File: apps/deploy-web/src/components/deployments/DeploymentBalanceAlert/DeploymentBalanceAlert.tsx:47-68
Timestamp: 2025-06-19T16:00:05.428Z
Learning: In React Hook Form setups with zod validation, child components using useFormContext() can rely on parent form validation rather than implementing local input validation. Invalid inputs like NaN from parseFloat() are handled by the parent schema validation, eliminating the need for additional local validation in child components.
Applied to files:
apps/deploy-web/src/components/auth/SignInForm/SignInForm.tsxapps/deploy-web/src/components/auth/SignUpForm/SignUpForm.tsx
🧬 Code graph analysis (14)
apps/deploy-web/src/queries/useSaveSettings.ts (1)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
useServices(33-35)
apps/deploy-web/src/hooks/useBackNav.ts (1)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
useServices(33-35)
apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsx (2)
apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.tsx (3)
SignUpForm(58-136)SignUpFormValues(37-37)DEPENDENCIES(45-56)apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.tsx (1)
DEPENDENCIES(15-20)
apps/deploy-web/src/hooks/useChainParam/useChainParam.tsx (4)
apps/deploy-web/src/components/auth/AuthPage/AuthPage.tsx (1)
DEPENDENCIES(23-38)apps/deploy-web/src/components/auth/SignInForm/SignInForm.tsx (1)
DEPENDENCIES(27-36)apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.tsx (1)
DEPENDENCIES(15-20)apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.tsx (1)
DEPENDENCIES(45-56)
apps/deploy-web/src/pages/_app.tsx (1)
apps/deploy-web/src/context/LocalNoteProvider/LocalNoteContext.tsx (1)
LocalNoteProvider(21-60)
apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsx (2)
apps/deploy-web/tests/unit/TestContainerProvider.tsx (1)
TestContainerProvider(9-32)apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.tsx (2)
SignUpButton(22-41)DEPENDENCIES(15-20)
apps/deploy-web/src/components/auth/SignInForm/SignInForm.tsx (4)
apps/deploy-web/src/components/auth/AuthPage/AuthPage.tsx (1)
DEPENDENCIES(23-38)apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.tsx (1)
DEPENDENCIES(15-20)apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.tsx (1)
DEPENDENCIES(45-56)apps/deploy-web/src/components/shared/RemoteApiError/RemoteApiError.tsx (1)
DEPENDENCIES(10-13)
apps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsx (1)
apps/deploy-web/src/components/auth/SignInForm/SignInForm.tsx (3)
SignInForm(38-117)SignInFormValues(16-16)DEPENDENCIES(27-36)
apps/deploy-web/src/hooks/useChainParam/useChainParam.spec.tsx (1)
apps/deploy-web/src/hooks/useChainParam/useChainParam.tsx (1)
useChainParam(25-41)
apps/deploy-web/src/components/auth/AuthPage/AuthPage.spec.tsx (2)
apps/deploy-web/tests/unit/TestContainerProvider.tsx (1)
TestContainerProvider(9-32)apps/deploy-web/src/components/auth/AuthPage/AuthPage.tsx (2)
AuthPage(44-218)DEPENDENCIES(23-38)
apps/deploy-web/src/hooks/useLoginRequiredEventHandler.tsx (2)
apps/deploy-web/src/hooks/useUser.ts (1)
useUser(7-20)apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
useServices(33-35)
apps/deploy-web/src/components/auth/AuthPage/AuthPage.tsx (5)
apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.tsx (1)
DEPENDENCIES(15-20)apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
useServices(33-35)apps/deploy-web/src/components/auth/SignInForm/SignInForm.tsx (1)
DEPENDENCIES(27-36)apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.tsx (1)
DEPENDENCIES(45-56)apps/deploy-web/src/hooks/useChainParam/useChainParam.tsx (1)
DEPENDENCIES(19-23)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (2)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (2)
useSettings(327-329)SettingsContextType(41-41)apps/deploy-web/src/services/container/createContainer.ts (1)
Factories(40-40)
apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.tsx (6)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
Props(16-19)apps/deploy-web/src/components/new-deployment/CreateLease/CreateLease.tsx (2)
Props(64-67)DEPENDENCIES(69-109)apps/deploy-web/src/components/auth/AuthPage/AuthPage.tsx (1)
DEPENDENCIES(23-38)apps/deploy-web/src/components/auth/SignInForm/SignInForm.tsx (1)
DEPENDENCIES(27-36)apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.tsx (1)
DEPENDENCIES(45-56)apps/deploy-web/src/hooks/useChainParam/useChainParam.tsx (1)
DEPENDENCIES(19-23)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: validate / validate-app
- GitHub Check: test-build
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (23)
apps/deploy-web/src/queries/useSaveSettings.ts (1)
42-42: LGTM: Clear constant definition.The constant is well-named and the calculation is correct.
apps/deploy-web/src/hooks/useManagedEscrowFaqModal.tsx (1)
8-8: LGTM! Import path updated correctly.The import path change aligns with the PR's objective to convert
ChainParamContextto a hook. All old imports from@src/context/ChainParamProviderhave been removed, and the new hook file exists at@src/hooks/useChainParam/useChainParamwith the correct export.apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsx (2)
5-5: LGTM! Proper dependency injection pattern.The test correctly imports and uses
DEPENDENCIESto enable dependency injection for the component under test.
62-81: LGTM! Test setup follows coding guidelines.The
setupfunction correctly follows all coding guidelines:
- Positioned at the bottom of the describe block
- Accepts a single parameter with inline type definition
- Returns an object without an explicit return type annotation
- Avoids shared state
- Properly injects dependencies via the
dependenciespropapps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsx (2)
5-5: LGTM! Consistent dependency injection pattern.The test correctly imports and uses
DEPENDENCIESto enable dependency injection, consistent with the pattern used across other auth component tests.
54-73: LGTM! Test setup follows coding guidelines.The
setupfunction properly follows all coding guidelines and correctly injects thegoBackmock via thedependenciesprop, maintaining consistency with the updated SignInForm API.apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.tsx (2)
15-20: LGTM! Well-structured dependency injection.The
DEPENDENCIESobject properly aggregates all injectable dependencies, enabling testability while maintaining clean production usage.
22-41: LGTM! Correct dependency injection implementation.The component correctly:
- Accepts optional dependencies via props with sensible defaults
- Resolves all UI primitives and hooks through the dependencies object
- Maintains consistent usage pattern across both rendering paths (button and link)
This pattern aligns well with the DI approach used across other auth components.
apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsx (2)
7-7: LGTM! Proper dependency injection for testing.The test correctly imports
DEPENDENCIESto enable router injection during testing.
68-72: LGTM! Correct test dependency injection.The test properly injects a mocked router via the
dependenciesprop while preserving theDEPENDENCIESdefaults, enabling isolated testing of routing behavior.apps/deploy-web/src/components/sdl/DeploymentMinimumEscrowAlertText.tsx (1)
4-4: LGTM! Import path updated for hook-based architecture.The import path correctly reflects the refactoring from context-based to hook-based architecture, with no behavioral changes to the component.
apps/deploy-web/src/hooks/useWalletBalance.ts (1)
6-6: LGTM! Import path updated for hook-based architecture.The import path correctly reflects the refactoring from context-based to hook-based architecture, maintaining the same functionality.
apps/deploy-web/src/pages/_app.tsx (1)
114-114: LGTM! ChainParamProvider successfully removed.The removal of
ChainParamProviderfrom the provider tree correctly completes the refactoring from context-based to hook-based architecture. Components now access chain parameters directly via theuseChainParamhook instead of through context.apps/deploy-web/src/components/auth/AuthPage/AuthPage.spec.tsx (1)
236-248: LGTM! Proper DI pattern for router injection.The test correctly migrates from providing
routerviaservicesto injectinguseRouterthrough thedependenciesprop. This aligns with the component's updated dependency injection approach.apps/deploy-web/src/components/shared/PrerequisiteList.tsx (1)
7-7: LGTM!Import path correctly updated to the new hook location as part of the context-to-hook refactor.
apps/deploy-web/src/components/get-started/GetStartedStepper.tsx (1)
18-18: LGTM!Import path correctly updated to the new hook location.
apps/deploy-web/src/hooks/useChainParam/useChainParam.spec.tsx (1)
1-87: LGTM! Well-structured test suite.The test file follows all coding guidelines:
- Uses
useChainParam.namein describe block- Uses
setupfunction at the bottom of describe block with inline parameter type- Uses
jest-mock-extendedfor mocking instead ofjest.mock()- Avoids shared state and
beforeEach- Good coverage of edge cases (undefined params, conversions, missing denoms, enabled flag logic)
apps/deploy-web/src/components/auth/AuthPage/AuthPage.tsx (1)
9-9: LGTM! Clean migration to DI pattern for router.The router is now properly sourced from dependencies (
d.useRouter()) instead ofuseServices(), enabling better testability. The DEPENDENCIES export correctly includes bothuseSearchParamsanduseRouter.Also applies to: 36-37, 45-46
apps/deploy-web/src/components/auth/SignInForm/SignInForm.tsx (1)
38-116: LGTM! Clean DI implementation.The component correctly uses the injected dependencies throughout, enabling full testability. The pattern is consistent with
SignUpFormand other auth components in the PR.apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
25-28: LGTM on the memoization approach.The
useMemocorrectly captures the relevant dependencies from the settings state that affect container creation. This prevents unnecessary re-instantiation of services when unrelated settings change.apps/deploy-web/src/hooks/useChainParam/useChainParam.tsx (1)
25-40: LGTM on the hook implementation.The dependency injection pattern via
DEPENDENCIESis consistent with the approach used in other components (SignUpButton, SignInForm, AuthPage). TheuseMemocorrectly capturesdepositParamsandusdcDenomas dependencies, and the fallback logic handles missing/undefined values gracefully.apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.tsx (2)
45-56: LGTM on the dependency injection pattern.The
DEPENDENCIESconstant follows the same pattern established inSignInForm,SignUpButton, andAuthPage, ensuring consistency across auth components. This enables easier testing by allowing mock injection.
58-68: LGTM on the component refactor.The function signature correctly accepts optional dependencies with a sensible default. Hooks are properly accessed through the dependency object, maintaining the component's functionality while enabling testability.
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx
Outdated
Show resolved
Hide resolved
eb1c188 to
fd9ec66
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (4)
apps/deploy-web/src/hooks/useBackNav.ts (1)
10-16: Consider usingrouterinstead ofrouter.asPathin the dependency array.The callback depends on
router.back()androuter.push()methods, not specifically onrouter.asPath. Whilerouter.asPathmay work as an optimization to reduce unnecessary recreations, using therouterobject itself is more semantically correct and ensures the callback always has the latest router instance.🔎 Suggested change
return useCallback(() => { if (windowHistory.length > 1) { router.back(); } else { router.push(fallback); } - }, [router.asPath, windowHistory, fallback]); + }, [router, windowHistory, fallback]); };apps/deploy-web/tests/unit/mocks.tsx (1)
12-12: Remove redundant type check.
Object.keys()always returns strings, sotypeof name === "string"is unnecessary.🔎 Suggested change
- all[name] = overrides?.[name] || (jest.fn(typeof name === "string" && name.startsWith("use") ? undefined : ComponentMock) as T[keyof T]); + all[name] = overrides?.[name] || (jest.fn(name.startsWith("use") ? undefined : ComponentMock) as T[keyof T]);apps/deploy-web/src/hooks/useChainParam/useChainParam.tsx (1)
32-40: Consider simplifying the null-handling logic for clarity.The calculation logic is correct but uses a complex chain of fallbacks:
parseFloat(...?.amount || "") || 0. While functional, this pattern could be more explicit for maintainability.🔎 Optional refactor for clearer null-handling
return useMemo( () => ({ minDeposit: { - akt: depositParams ? uaktToAKT(parseFloat(depositParams.find(x => x.denom === UAKT_DENOM)?.amount || "") || 0) : 0, - usdc: depositParams ? udenomToDenom(parseFloat(depositParams.find(x => x.denom === usdcDenom)?.amount || "") || 0) : 0 + akt: depositParams ? uaktToAKT(parseFloat(depositParams.find(x => x.denom === UAKT_DENOM)?.amount ?? "0") || 0) : 0, + usdc: depositParams ? udenomToDenom(parseFloat(depositParams.find(x => x.denom === usdcDenom)?.amount ?? "0") || 0) : 0 } }), [depositParams, usdcDenom] );Using nullish coalescing (
??) makes it clearer that we're specifically handling null/undefined rather than all falsy values.apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
18-18: Consider extracting the services type for clarity.The conditional type extraction is complex. You could define a helper type alias to improve readability:
type AppFactories = AppDIContainer extends DIContainer<infer TFactories> ? TFactories : never; export type Props = { children: React.ReactNode; services?: Partial<AppFactories>; };
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (23)
apps/deploy-web/src/components/auth/AuthPage/AuthPage.spec.tsxapps/deploy-web/src/components/auth/AuthPage/AuthPage.tsxapps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsxapps/deploy-web/src/components/auth/SignInForm/SignInForm.tsxapps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsxapps/deploy-web/src/components/auth/SignUpButton/SignUpButton.tsxapps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsxapps/deploy-web/src/components/auth/SignUpForm/SignUpForm.tsxapps/deploy-web/src/components/get-started/GetStartedStepper.tsxapps/deploy-web/src/components/sdl/DeploymentMinimumEscrowAlertText.tsxapps/deploy-web/src/components/shared/PrerequisiteList.tsxapps/deploy-web/src/context/ChainParamProvider/ChainParamProvider.tsxapps/deploy-web/src/context/ChainParamProvider/index.tsapps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsxapps/deploy-web/src/hooks/useBackNav.tsapps/deploy-web/src/hooks/useChainParam/useChainParam.spec.tsxapps/deploy-web/src/hooks/useChainParam/useChainParam.tsxapps/deploy-web/src/hooks/useLoginRequiredEventHandler.tsxapps/deploy-web/src/hooks/useManagedEscrowFaqModal.tsxapps/deploy-web/src/hooks/useWalletBalance.tsapps/deploy-web/src/pages/_app.tsxapps/deploy-web/src/queries/useSaveSettings.tsapps/deploy-web/tests/unit/mocks.tsx
💤 Files with no reviewable changes (2)
- apps/deploy-web/src/context/ChainParamProvider/index.ts
- apps/deploy-web/src/context/ChainParamProvider/ChainParamProvider.tsx
🚧 Files skipped from review as they are similar to previous changes (9)
- apps/deploy-web/src/hooks/useLoginRequiredEventHandler.tsx
- apps/deploy-web/src/queries/useSaveSettings.ts
- apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.tsx
- apps/deploy-web/src/components/auth/AuthPage/AuthPage.tsx
- apps/deploy-web/src/hooks/useWalletBalance.ts
- apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsx
- apps/deploy-web/src/components/get-started/GetStartedStepper.tsx
- apps/deploy-web/src/components/shared/PrerequisiteList.tsx
- apps/deploy-web/src/components/auth/AuthPage/AuthPage.spec.tsx
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/*.{ts,tsx,js}: Never use typeanyor cast to typeany. Always define the proper TypeScript types.
Never use deprecated methods from libraries.
Don't add unnecessary comments to the code.
Files:
apps/deploy-web/src/components/sdl/DeploymentMinimumEscrowAlertText.tsxapps/deploy-web/src/hooks/useBackNav.tsapps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsxapps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsxapps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsxapps/deploy-web/src/hooks/useChainParam/useChainParam.spec.tsxapps/deploy-web/src/components/auth/SignUpForm/SignUpForm.tsxapps/deploy-web/src/pages/_app.tsxapps/deploy-web/tests/unit/mocks.tsxapps/deploy-web/src/hooks/useChainParam/useChainParam.tsxapps/deploy-web/src/hooks/useManagedEscrowFaqModal.tsxapps/deploy-web/src/components/auth/SignInForm/SignInForm.tsx
**/*.spec.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/no-jest-mock.mdc)
Don't use
jest.mock()in test files. Instead, usejest-mock-extendedto create mocks and pass mocks as dependencies to the service under testUse
setupfunction instead ofbeforeEachin test files. Thesetupfunction must be at the bottom of the rootdescribeblock, should create an object under test and return it, accept a single parameter with inline type definition, avoid shared state, and not have a specified return type.
**/*.spec.{ts,tsx}: Use<Subject>.namein the root describe suite description instead of hardcoded class/service name strings to enable automated refactoring tools to find all references
Use either a method name or a condition starting with 'when' for nested suite descriptions in tests
Use present simple, 3rd person singular for test descriptions without prepending 'should'
Files:
apps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsxapps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsxapps/deploy-web/src/hooks/useChainParam/useChainParam.spec.tsx
{apps/deploy-web,apps/provider-console}/**/*.spec.tsx
📄 CodeRabbit inference engine (.cursor/rules/query-by-in-tests.mdc)
Use
queryBymethods instead ofgetBymethods in test expectations
Files:
apps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsxapps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsxapps/deploy-web/src/hooks/useChainParam/useChainParam.spec.tsx
🧠 Learnings (11)
📓 Common learnings
Learnt from: baktun14
Repo: akash-network/console PR: 1725
File: apps/api/src/utils/constants.ts:5-5
Timestamp: 2025-07-24T17:00:52.361Z
Learning: In the Akash Network Console project, when cross-cutting concerns or broader refactoring issues are identified during PR review, the preferred approach is to create a separate GitHub issue to track the work rather than expanding the scope of the current PR. This maintains focus and allows for proper planning of architectural improvements.
Learnt from: stalniy
Repo: akash-network/console PR: 2255
File: apps/api/src/middlewares/privateMiddleware.ts:5-9
Timestamp: 2025-11-19T16:13:43.249Z
Learning: In the Akash Console API (apps/api), avoid resolving DI container dependencies at module scope (module initialization time) to prevent side effects. Instead, resolve dependencies inside functions/methods where they are actually used, even if this means resolving on every invocation, to maintain explicit control over when side effects occur and improve testability.
📚 Learning: 2025-11-25T17:45:39.561Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-11-25T17:45:39.561Z
Learning: Applies to **/*.{ts,tsx,js} : Never use deprecated methods from libraries.
Applied to files:
apps/deploy-web/src/components/sdl/DeploymentMinimumEscrowAlertText.tsx
📚 Learning: 2025-06-05T21:07:51.985Z
Learnt from: baktun14
Repo: akash-network/console PR: 1432
File: apps/deploy-web/src/components/deployments/DeploymentAlerts/DeploymentCloseAlert.tsx:38-38
Timestamp: 2025-06-05T21:07:51.985Z
Learning: The ContactPointSelect component in apps/deploy-web/src/components/alerts/ContactPointSelectForm/ContactPointSelect.tsx uses the useFormContext hook internally to connect to React Hook Form, so it doesn't need to be wrapped in a FormField component.
Applied to files:
apps/deploy-web/src/components/sdl/DeploymentMinimumEscrowAlertText.tsxapps/deploy-web/src/components/auth/SignUpForm/SignUpForm.tsxapps/deploy-web/src/components/auth/SignInForm/SignInForm.tsx
📚 Learning: 2025-11-25T17:45:49.180Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-11-25T17:45:49.180Z
Learning: Applies to {apps/deploy-web,apps/provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations
Applied to files:
apps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsxapps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsxapps/deploy-web/src/hooks/useChainParam/useChainParam.spec.tsxapps/deploy-web/tests/unit/mocks.tsx
📚 Learning: 2025-11-25T17:45:52.965Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-11-25T17:45:52.965Z
Learning: Applies to **/*.spec.{ts,tsx} : Use `setup` function instead of `beforeEach` in test files. The `setup` function must be at the bottom of the root `describe` block, should create an object under test and return it, accept a single parameter with inline type definition, avoid shared state, and not have a specified return type.
Applied to files:
apps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsxapps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsxapps/deploy-web/src/hooks/useChainParam/useChainParam.spec.tsxapps/deploy-web/tests/unit/mocks.tsx
📚 Learning: 2025-07-11T10:46:43.711Z
Learnt from: stalniy
Repo: akash-network/console PR: 1660
File: apps/deploy-web/src/components/alerts/DeploymentAlertsContainer/DeploymentAlertsContainer.spec.tsx:54-56
Timestamp: 2025-07-11T10:46:43.711Z
Learning: In apps/{deploy-web,provider-console}/**/*.spec.tsx files: Use `getBy` methods instead of `queryBy` methods when testing element presence with `toBeInTheDocument()` because `getBy` throws an error and shows DOM state when element is not found, providing better debugging information than `queryBy` which returns null.
Applied to files:
apps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsxapps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsxapps/deploy-web/tests/unit/mocks.tsx
📚 Learning: 2025-11-25T17:45:44.790Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/no-jest-mock.mdc:0-0
Timestamp: 2025-11-25T17:45:44.790Z
Learning: Applies to **/*.spec.{ts,tsx} : Don't use `jest.mock()` in test files. Instead, use `jest-mock-extended` to create mocks and pass mocks as dependencies to the service under test
Applied to files:
apps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsxapps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsxapps/deploy-web/tests/unit/mocks.tsx
📚 Learning: 2025-11-25T17:45:58.258Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/test-descriptions.mdc:0-0
Timestamp: 2025-11-25T17:45:58.258Z
Learning: Applies to **/*.spec.{ts,tsx} : Use `<Subject>.name` in the root describe suite description instead of hardcoded class/service name strings to enable automated refactoring tools to find all references
Applied to files:
apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsxapps/deploy-web/tests/unit/mocks.tsx
📚 Learning: 2025-10-15T16:39:55.348Z
Learnt from: jzsfkzm
Repo: akash-network/console PR: 2039
File: apps/deploy-web/tests/ui/change-wallets.spec.ts:4-10
Timestamp: 2025-10-15T16:39:55.348Z
Learning: In the Akash Console E2E tests using the context-with-extension fixture, the first wallet is automatically created during fixture setup via `importWalletToLeap` in `apps/deploy-web/tests/ui/fixture/wallet-setup.ts`, so tests that call `frontPage.createWallet()` are creating a second wallet to test wallet switching functionality.
Applied to files:
apps/deploy-web/src/hooks/useChainParam/useChainParam.spec.tsx
📚 Learning: 2025-06-19T16:00:05.428Z
Learnt from: ygrishajev
Repo: akash-network/console PR: 1512
File: apps/deploy-web/src/components/deployments/DeploymentBalanceAlert/DeploymentBalanceAlert.tsx:47-68
Timestamp: 2025-06-19T16:00:05.428Z
Learning: In React Hook Form setups with zod validation, child components using useFormContext() can rely on parent form validation rather than implementing local input validation. Invalid inputs like NaN from parseFloat() are handled by the parent schema validation, eliminating the need for additional local validation in child components.
Applied to files:
apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.tsxapps/deploy-web/src/components/auth/SignInForm/SignInForm.tsx
📚 Learning: 2025-11-19T15:15:07.283Z
Learnt from: ygrishajev
Repo: akash-network/console PR: 2254
File: apps/api/test/functional/sign-and-broadcast-tx.spec.ts:4-4
Timestamp: 2025-11-19T15:15:07.283Z
Learning: In the Akash Network Console project, when tests use native Node.js fetch (available in Node 18+), fetch-mock should be used for HTTP mocking instead of nock, as nock does not support intercepting native fetch calls. This applies to apps/api/test/functional/sign-and-broadcast-tx.spec.ts and any other tests using native fetch.
Applied to files:
apps/deploy-web/tests/unit/mocks.tsx
🧬 Code graph analysis (8)
apps/deploy-web/src/hooks/useBackNav.ts (1)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
useServices(33-35)
apps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsx (1)
apps/deploy-web/src/components/auth/SignInForm/SignInForm.tsx (3)
SignInForm(38-117)SignInFormValues(16-16)DEPENDENCIES(27-36)
apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsx (4)
apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.tsx (3)
SignUpForm(58-136)SignUpFormValues(37-37)DEPENDENCIES(45-56)apps/deploy-web/src/components/auth/AuthPage/AuthPage.tsx (1)
DEPENDENCIES(23-38)apps/deploy-web/src/components/auth/SignInForm/SignInForm.tsx (1)
DEPENDENCIES(27-36)apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.tsx (1)
DEPENDENCIES(15-20)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (2)
apps/deploy-web/src/context/SettingsProvider/SettingsProviderContext.tsx (2)
useSettings(327-329)SettingsContextType(41-41)apps/deploy-web/src/services/container/createContainer.ts (1)
Factories(40-40)
apps/deploy-web/src/hooks/useChainParam/useChainParam.spec.tsx (1)
apps/deploy-web/src/hooks/useChainParam/useChainParam.tsx (1)
useChainParam(25-41)
apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.tsx (4)
apps/deploy-web/src/components/auth/AuthPage/AuthPage.tsx (1)
DEPENDENCIES(23-38)apps/deploy-web/src/components/auth/SignInForm/SignInForm.tsx (1)
DEPENDENCIES(27-36)apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.tsx (1)
DEPENDENCIES(15-20)apps/deploy-web/src/hooks/useChainParam/useChainParam.tsx (1)
DEPENDENCIES(19-23)
apps/deploy-web/src/pages/_app.tsx (1)
apps/deploy-web/src/context/LocalNoteProvider/LocalNoteContext.tsx (1)
LocalNoteProvider(21-60)
apps/deploy-web/src/hooks/useChainParam/useChainParam.tsx (4)
apps/deploy-web/src/components/auth/AuthPage/AuthPage.tsx (1)
DEPENDENCIES(23-38)apps/deploy-web/src/components/auth/SignInForm/SignInForm.tsx (1)
DEPENDENCIES(27-36)apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.tsx (1)
DEPENDENCIES(15-20)apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.tsx (1)
DEPENDENCIES(45-56)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: validate / validate-app
- GitHub Check: test-build
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (15)
apps/deploy-web/src/components/sdl/DeploymentMinimumEscrowAlertText.tsx (1)
4-4: LGTM!Import path correctly updated to use the new hook location. The component's behavior remains unchanged.
apps/deploy-web/src/hooks/useManagedEscrowFaqModal.tsx (1)
8-8: LGTM!Import path correctly updated to the new hook location.
apps/deploy-web/src/pages/_app.tsx (1)
113-115: LGTM!Clean removal of
ChainParamProviderfrom the provider tree. Components now consume chain params via the hook directly, reducing unnecessary context nesting and aligning with the PR objective.apps/deploy-web/src/hooks/useChainParam/useChainParam.spec.tsx (1)
1-86: LGTM!Well-structured test suite that follows the coding guidelines:
- Uses
useChainParam.namein the describe block- Uses
jest-mock-extendedfor mocking instead ofjest.mock()setupfunction is at the bottom of the describe block with proper structure- Tests cover key scenarios: undefined params, conversion, missing denom, and
enabledflag propagationapps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsx (1)
1-82: LGTM!Test suite properly refactored to use the DI pattern:
- Uses
SignUpForm.namein the root describe- Imports and spreads
DEPENDENCIESwith mock overrides- Uses
queryBymethods in expectations (lines 38, 58, 59)setupfunction at bottom with proper structure- No
jest.mock()usedapps/deploy-web/src/components/auth/SignInForm/SignInForm.tsx (1)
27-46: LGTM!Clean implementation of the dependency injection pattern:
DEPENDENCIESconstant properly exports UI components and hooks- Component signature accepts optional
dependenciesprop with correct typing- Hook usage (
useForm,useBackNav) correctly sourced from dependencies- Consistent with the DI pattern used in
SignUpFormandSignUpButtonapps/deploy-web/src/components/auth/SignUpForm/SignUpForm.tsx (2)
39-56: LGTM! Dependency injection pattern properly implemented.The DEPENDENCIES object and optional dependencies prop enable clean testing and follow the established pattern across auth components.
58-135: LGTM! Component properly refactored for dependency injection.All UI components and hooks are correctly accessed through the dependencies object while preserving the original form logic and behavior.
apps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsx (2)
5-5: LGTM! Tests properly adapted for dependency injection.The test suite correctly injects the
useBackNavmock through the dependencies prop and validates the navigation behavior. The customrerenderhelper properly preserves dependencies across re-renders.Also applies to: 34-41, 54-73
24-32: LGTM! Loading state test correctly updated.The test properly uses the new
rerenderhelper to validate loading state behavior.apps/deploy-web/src/hooks/useChainParam/useChainParam.tsx (2)
10-23: LGTM! Types and dependencies properly structured.The type definitions are clear, and the DEPENDENCIES object follows the established pattern for dependency injection across the codebase.
25-30: LGTM! Hook properly implements dependency injection.The hook signature and data fetching logic correctly use the dependencies pattern while maintaining proper query enabling logic.
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (3)
1-1: LGTM: Clean imports and type simplification.The addition of
useMemoand the simplification ofAppDIContainerto useReturnTypeimproves maintainability by keeping the type in sync with the implementation.Also applies to: 21-21
38-38: Improved signature for testing flexibility.Changing the signature to accept
Partial<T> | undefinedmakes it easier to provide partial service overrides for testing, which aligns with the PR's refactoring goals.
47-48: Past debug console.log has been removed.The previous review comment flagged a debug
console.logstatement at these lines, but it's no longer present in the current code. This issue has been resolved.
fd9ec66 to
d2535bf
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/deploy-web/src/hooks/useLoginRequiredEventHandler.tsx (1)
45-46: Add missing dependencies to useCallback.The dependency array is missing
routerandurlService, both of which are used inside the callback (lines 28, 36). While these values are likely stable in practice, including them ensures correctness and satisfies React's exhaustive-deps rule.🔎 Proposed fix
[user?.userId, requireAction] + [user?.userId, requireAction, router, urlService] );
♻️ Duplicate comments (1)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
25-28: Previous concern about dependency array remains unaddressed.The dependency array omits
settingsState.setSettingsandsettingsState.refreshNodeStatuses, which are used within the memoized container (lines 66 and 84). WhilerefreshNodeStatusesis stable viauseCallback,setSettingsmay not be, potentially causing the container to capture stale function references.
🧹 Nitpick comments (3)
apps/deploy-web/src/queries/useSaveSettings.ts (1)
48-49: LGTM! Caching configuration looks appropriate.Setting both
staleTimeandgcTimeto one hour is reasonable for deposit parameters, which typically don't change frequently. This will reduce unnecessary refetches and improve performance, aligning with the PR's goal of improving app rendering.Consider verifying that one hour is appropriate for the actual volatility of deposit parameters in your blockchain environment, though this duration seems sensible for most scenarios.
apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsx (1)
38-38: Consider usinggetByinstead ofqueryByfortoBeInTheDocument()checks.Based on learnings, using
getBymethods for element presence checks withtoBeInTheDocument()provides better debugging information. When an element is not found,getBythrows an error and shows the DOM state, whereasqueryByreturns null and provides less context.🔎 Suggested changes
- expect(screen.queryByRole("status")).toBeInTheDocument(); - expect(screen.queryByText("Sign up")).not.toBeInTheDocument(); + expect(screen.getByRole("status")).toBeInTheDocument(); + expect(screen.queryByText("Sign up")).not.toBeInTheDocument();- expect(screen.queryByText("Invalid email")).toBeInTheDocument(); - expect(screen.queryByText("You must accept the terms and conditions")).toBeInTheDocument(); + expect(screen.getByText("Invalid email")).toBeInTheDocument(); + expect(screen.getByText("You must accept the terms and conditions")).toBeInTheDocument();Note: Keep
queryByfor negative assertions likenot.toBeInTheDocument().Based on learnings, for better debugging when elements are not found.
Also applies to: 59-59
apps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsx (1)
30-30: Consider usinggetByfortoBeInTheDocument()check.Line 30 uses
queryByfor an element presence check withtoBeInTheDocument(), while Line 51 correctly usesgetBy. For consistency and better debugging information when elements are not found, consider usinggetByhere as well.🔎 Suggested change
- expect(screen.queryByRole("status")).toBeInTheDocument(); + expect(screen.getByRole("status")).toBeInTheDocument();Based on learnings, for better debugging when the element is not found.
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (23)
apps/deploy-web/src/components/auth/AuthPage/AuthPage.spec.tsxapps/deploy-web/src/components/auth/AuthPage/AuthPage.tsxapps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsxapps/deploy-web/src/components/auth/SignInForm/SignInForm.tsxapps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsxapps/deploy-web/src/components/auth/SignUpButton/SignUpButton.tsxapps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsxapps/deploy-web/src/components/auth/SignUpForm/SignUpForm.tsxapps/deploy-web/src/components/get-started/GetStartedStepper.tsxapps/deploy-web/src/components/sdl/DeploymentMinimumEscrowAlertText.tsxapps/deploy-web/src/components/shared/PrerequisiteList.tsxapps/deploy-web/src/context/ChainParamProvider/ChainParamProvider.tsxapps/deploy-web/src/context/ChainParamProvider/index.tsapps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsxapps/deploy-web/src/hooks/useBackNav.tsapps/deploy-web/src/hooks/useChainParam/useChainParam.spec.tsxapps/deploy-web/src/hooks/useChainParam/useChainParam.tsxapps/deploy-web/src/hooks/useLoginRequiredEventHandler.tsxapps/deploy-web/src/hooks/useManagedEscrowFaqModal.tsxapps/deploy-web/src/hooks/useWalletBalance.tsapps/deploy-web/src/pages/_app.tsxapps/deploy-web/src/queries/useSaveSettings.tsapps/deploy-web/tests/unit/mocks.tsx
💤 Files with no reviewable changes (2)
- apps/deploy-web/src/context/ChainParamProvider/index.ts
- apps/deploy-web/src/context/ChainParamProvider/ChainParamProvider.tsx
🚧 Files skipped from review as they are similar to previous changes (9)
- apps/deploy-web/src/components/sdl/DeploymentMinimumEscrowAlertText.tsx
- apps/deploy-web/src/pages/_app.tsx
- apps/deploy-web/src/components/auth/AuthPage/AuthPage.tsx
- apps/deploy-web/tests/unit/mocks.tsx
- apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsx
- apps/deploy-web/src/hooks/useWalletBalance.ts
- apps/deploy-web/src/hooks/useChainParam/useChainParam.spec.tsx
- apps/deploy-web/src/hooks/useManagedEscrowFaqModal.tsx
- apps/deploy-web/src/hooks/useChainParam/useChainParam.tsx
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/*.{ts,tsx,js}: Never use typeanyor cast to typeany. Always define the proper TypeScript types.
Never use deprecated methods from libraries.
Don't add unnecessary comments to the code.
Files:
apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsxapps/deploy-web/src/components/get-started/GetStartedStepper.tsxapps/deploy-web/src/hooks/useBackNav.tsapps/deploy-web/src/components/auth/AuthPage/AuthPage.spec.tsxapps/deploy-web/src/hooks/useLoginRequiredEventHandler.tsxapps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsxapps/deploy-web/src/components/shared/PrerequisiteList.tsxapps/deploy-web/src/queries/useSaveSettings.tsapps/deploy-web/src/components/auth/SignInForm/SignInForm.tsxapps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsxapps/deploy-web/src/components/auth/SignUpForm/SignUpForm.tsxapps/deploy-web/src/components/auth/SignUpButton/SignUpButton.tsx
**/*.spec.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/no-jest-mock.mdc)
Don't use
jest.mock()in test files. Instead, usejest-mock-extendedto create mocks and pass mocks as dependencies to the service under testUse
setupfunction instead ofbeforeEachin test files. Thesetupfunction must be at the bottom of the rootdescribeblock, should create an object under test and return it, accept a single parameter with inline type definition, avoid shared state, and not have a specified return type.
**/*.spec.{ts,tsx}: Use<Subject>.namein the root describe suite description instead of hardcoded class/service name strings to enable automated refactoring tools to find all references
Use either a method name or a condition starting with 'when' for nested suite descriptions in tests
Use present simple, 3rd person singular for test descriptions without prepending 'should'
Files:
apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsxapps/deploy-web/src/components/auth/AuthPage/AuthPage.spec.tsxapps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsx
{apps/deploy-web,apps/provider-console}/**/*.spec.tsx
📄 CodeRabbit inference engine (.cursor/rules/query-by-in-tests.mdc)
Use
queryBymethods instead ofgetBymethods in test expectations
Files:
apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsxapps/deploy-web/src/components/auth/AuthPage/AuthPage.spec.tsxapps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsx
🧠 Learnings (10)
📓 Common learnings
Learnt from: baktun14
Repo: akash-network/console PR: 1725
File: apps/api/src/utils/constants.ts:5-5
Timestamp: 2025-07-24T17:00:52.361Z
Learning: In the Akash Network Console project, when cross-cutting concerns or broader refactoring issues are identified during PR review, the preferred approach is to create a separate GitHub issue to track the work rather than expanding the scope of the current PR. This maintains focus and allows for proper planning of architectural improvements.
Learnt from: stalniy
Repo: akash-network/console PR: 2255
File: apps/api/src/middlewares/privateMiddleware.ts:5-9
Timestamp: 2025-11-19T16:13:43.249Z
Learning: In the Akash Console API (apps/api), avoid resolving DI container dependencies at module scope (module initialization time) to prevent side effects. Instead, resolve dependencies inside functions/methods where they are actually used, even if this means resolving on every invocation, to maintain explicit control over when side effects occur and improve testability.
📚 Learning: 2025-11-25T17:45:49.180Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/query-by-in-tests.mdc:0-0
Timestamp: 2025-11-25T17:45:49.180Z
Learning: Applies to {apps/deploy-web,apps/provider-console}/**/*.spec.tsx : Use `queryBy` methods instead of `getBy` methods in test expectations
Applied to files:
apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsxapps/deploy-web/src/components/auth/AuthPage/AuthPage.spec.tsxapps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsx
📚 Learning: 2025-11-25T17:45:52.965Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/setup-instead-of-before-each.mdc:0-0
Timestamp: 2025-11-25T17:45:52.965Z
Learning: Applies to **/*.spec.{ts,tsx} : Use `setup` function instead of `beforeEach` in test files. The `setup` function must be at the bottom of the root `describe` block, should create an object under test and return it, accept a single parameter with inline type definition, avoid shared state, and not have a specified return type.
Applied to files:
apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsxapps/deploy-web/src/components/auth/AuthPage/AuthPage.spec.tsxapps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsx
📚 Learning: 2025-11-25T17:45:44.790Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/no-jest-mock.mdc:0-0
Timestamp: 2025-11-25T17:45:44.790Z
Learning: Applies to **/*.spec.{ts,tsx} : Don't use `jest.mock()` in test files. Instead, use `jest-mock-extended` to create mocks and pass mocks as dependencies to the service under test
Applied to files:
apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsxapps/deploy-web/src/components/auth/AuthPage/AuthPage.spec.tsxapps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsx
📚 Learning: 2025-07-11T10:46:43.711Z
Learnt from: stalniy
Repo: akash-network/console PR: 1660
File: apps/deploy-web/src/components/alerts/DeploymentAlertsContainer/DeploymentAlertsContainer.spec.tsx:54-56
Timestamp: 2025-07-11T10:46:43.711Z
Learning: In apps/{deploy-web,provider-console}/**/*.spec.tsx files: Use `getBy` methods instead of `queryBy` methods when testing element presence with `toBeInTheDocument()` because `getBy` throws an error and shows DOM state when element is not found, providing better debugging information than `queryBy` which returns null.
Applied to files:
apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsxapps/deploy-web/src/components/auth/AuthPage/AuthPage.spec.tsxapps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsx
📚 Learning: 2025-11-25T17:45:58.258Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/test-descriptions.mdc:0-0
Timestamp: 2025-11-25T17:45:58.258Z
Learning: Applies to **/*.spec.{ts,tsx} : Use `<Subject>.name` in the root describe suite description instead of hardcoded class/service name strings to enable automated refactoring tools to find all references
Applied to files:
apps/deploy-web/src/components/auth/AuthPage/AuthPage.spec.tsx
📚 Learning: 2025-11-25T17:45:39.561Z
Learnt from: CR
Repo: akash-network/console PR: 0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-11-25T17:45:39.561Z
Learning: Applies to **/*.{ts,tsx,js} : Never use deprecated methods from libraries.
Applied to files:
apps/deploy-web/src/components/shared/PrerequisiteList.tsx
📚 Learning: 2025-07-29T15:14:53.419Z
Learnt from: baktun14
Repo: akash-network/console PR: 1750
File: apps/deploy-web/src/components/onboarding/steps/PaymentVerificationCard/PaymentVerificationCard.tsx:33-37
Timestamp: 2025-07-29T15:14:53.419Z
Learning: CardDescription from akashnetwork/ui/components renders as a <p> element, so any block-level content inside it should use <div> (not <p>) to avoid invalid HTML nesting.
Applied to files:
apps/deploy-web/src/components/shared/PrerequisiteList.tsx
📚 Learning: 2025-06-05T21:07:51.985Z
Learnt from: baktun14
Repo: akash-network/console PR: 1432
File: apps/deploy-web/src/components/deployments/DeploymentAlerts/DeploymentCloseAlert.tsx:38-38
Timestamp: 2025-06-05T21:07:51.985Z
Learning: The ContactPointSelect component in apps/deploy-web/src/components/alerts/ContactPointSelectForm/ContactPointSelect.tsx uses the useFormContext hook internally to connect to React Hook Form, so it doesn't need to be wrapped in a FormField component.
Applied to files:
apps/deploy-web/src/components/auth/SignInForm/SignInForm.tsxapps/deploy-web/src/components/auth/SignUpForm/SignUpForm.tsx
📚 Learning: 2025-06-19T16:00:05.428Z
Learnt from: ygrishajev
Repo: akash-network/console PR: 1512
File: apps/deploy-web/src/components/deployments/DeploymentBalanceAlert/DeploymentBalanceAlert.tsx:47-68
Timestamp: 2025-06-19T16:00:05.428Z
Learning: In React Hook Form setups with zod validation, child components using useFormContext() can rely on parent form validation rather than implementing local input validation. Invalid inputs like NaN from parseFloat() are handled by the parent schema validation, eliminating the need for additional local validation in child components.
Applied to files:
apps/deploy-web/src/components/auth/SignInForm/SignInForm.tsxapps/deploy-web/src/components/auth/SignUpForm/SignUpForm.tsx
🧬 Code graph analysis (5)
apps/deploy-web/src/hooks/useBackNav.ts (1)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
useServices(33-35)
apps/deploy-web/src/hooks/useLoginRequiredEventHandler.tsx (2)
packages/ui/context/PopupProvider/PopupProvider.tsx (1)
usePopup(140-146)apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
useServices(33-35)
apps/deploy-web/src/queries/useSaveSettings.ts (1)
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)
useServices(33-35)
apps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsx (6)
apps/deploy-web/src/services/session/session.service.ts (1)
input(34-95)apps/deploy-web/src/components/auth/SignInForm/SignInForm.tsx (3)
SignInForm(38-117)SignInFormValues(16-16)DEPENDENCIES(27-36)apps/deploy-web/src/components/auth/AuthPage/AuthPage.tsx (1)
DEPENDENCIES(23-38)apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.tsx (1)
DEPENDENCIES(15-20)apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.tsx (1)
DEPENDENCIES(45-56)apps/deploy-web/src/components/shared/RemoteApiError/RemoteApiError.tsx (1)
DEPENDENCIES(10-13)
apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.tsx (4)
apps/deploy-web/src/components/auth/AuthPage/AuthPage.tsx (1)
DEPENDENCIES(23-38)apps/deploy-web/src/components/auth/SignInForm/SignInForm.tsx (1)
DEPENDENCIES(27-36)apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.tsx (2)
DEPENDENCIES(15-20)Props(7-13)packages/ui/components/spinner.tsx (1)
Spinner(10-39)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: validate / validate-app
- GitHub Check: test-build
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (15)
apps/deploy-web/src/hooks/useLoginRequiredEventHandler.tsx (1)
4-4: LGTM! Router migration aligns with PR objectives.The shift from obtaining the router via the DI container to using Next.js's
useRouterhook reduces coupling and aligns with the PR's goal of reducing redundant top-level contexts.Also applies to: 12-13
apps/deploy-web/src/queries/useSaveSettings.ts (1)
42-42: LGTM! Good practice to extract the magic number.The constant is correctly calculated and improves code readability.
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (3)
1-1: LGTM: useMemo import added for memoization.The addition of
useMemoto the React imports is correct and necessary for the new memoization logic introduced at lines 25-28.
21-21: LGTM: Type definition correctly derives from createAppContainer.The
AppDIContainertype now cleanly derives from the return type ofcreateAppContainer, ensuring type consistency without manual maintenance.
38-38: LGTM: Flexible signature improves testability.The updated signature accepting
Partial<T> | undefinedenables partial service mocking in tests while maintaining type safety through the generic constraintT extends Factories.apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.tsx (2)
15-20: LGTM! Clean dependency injection pattern.The DEPENDENCIES constant is well-structured and enables testability while maintaining explicit dependencies. This aligns with the PR's goal of improving component architecture.
22-41: LGTM! Dependency injection correctly implemented.The component implementation properly uses the injected dependencies throughout, resolving them within the function scope rather than at module level. This improves testability while preserving the original behavior.
Based on learnings, dependencies are resolved inside the function where they are used, maintaining explicit control and improving testability.
apps/deploy-web/src/components/auth/AuthPage/AuthPage.spec.tsx (1)
237-248: LGTM! Clean dependency injection refactor.The router has been successfully moved from the service container to explicit component dependencies. The
useRouter: () => routerinjection aligns with Next.js conventions and matches the pattern used for other hooks (useUser,useSearchParams). All tests properly use the router mock through the setup function's return value.apps/deploy-web/src/components/get-started/GetStartedStepper.tsx (1)
18-18: LGTM! Import path updated correctly.The import path has been successfully updated to match the new hook-based implementation. The hook usage at line 35 remains unchanged, maintaining consistent behavior across the stepper component.
apps/deploy-web/src/components/shared/PrerequisiteList.tsx (1)
7-7: Import path updated correctly. The hook has been successfully migrated to@src/hooks/useChainParam/useChainParam, and no remaining references to the old@src/context/ChainParamProviderpath exist in the deploy-web app. Hook usage remains unchanged.apps/deploy-web/src/hooks/useBackNav.ts (1)
2-8: LGTM! Router dependency array improvement.The refactoring correctly moves the router from the service container to Next.js's
useRouterhook, improving separation of concerns. The dependency array change fromroutertorouter.asPathis an improvement—since Next.js mutates the router object in place, usingrouter.asPathensures the callback recreates when navigation actually occurs.Also applies to: 16-16
apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsx (1)
62-81: LGTM! Clean dependency injection pattern.The setup function correctly implements the dependency injection pattern, injecting the
goBackmock via thedependenciesprop. The rerender wrapper properly preserves the dependencies injection while allowing partial prop updates. This aligns with the broader DI refactoring across auth components.apps/deploy-web/src/components/auth/SignInForm/SignInForm.tsx (1)
24-36: LGTM! Consistent dependency injection implementation.The dependency injection pattern is implemented correctly, matching the approach in
SignUpForm.tsx. TheDEPENDENCIESconstant aggregates all UI primitives and hooks, enabling easy testing through mock injection while preserving default behavior. All component references are properly resolved through the dependencies object.Also applies to: 38-116
apps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsx (1)
54-72: LGTM! Consistent test setup with dependency injection.The setup function correctly implements the dependency injection pattern, matching the approach in
SignUpForm.spec.tsx. ThegoBackmock is properly injected and the rerender wrapper maintains dependencies injection while accepting partial props.apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.tsx (1)
42-56: LGTM! Dependency injection implemented correctly.The dependency injection pattern is consistent with
SignInForm.tsx. TheDEPENDENCIESconstant appropriately includes additional components (Checkbox,FormMessage) required by this form's validation and UI needs. All component references are properly resolved through the dependencies object, enabling testability while maintaining default behavior.Also applies to: 58-135
Why
To reduce amount of redundant top level contexts and improve app rendering
Summary by CodeRabbit
Tests
Refactor
Performance
✏️ Tip: You can customize this high-level summary in your review settings.