Skip to content

refactor: converts ChainParamContext to hook#2403

Merged
stalniy merged 1 commit intomainfrom
refactor/chain-param-context
Dec 22, 2025
Merged

refactor: converts ChainParamContext to hook#2403
stalniy merged 1 commit intomainfrom
refactor/chain-param-context

Conversation

@stalniy
Copy link
Contributor

@stalniy stalniy commented Dec 20, 2025

Why

To reduce amount of redundant top level contexts and improve app rendering

Summary by CodeRabbit

  • Tests

    • Updated auth and form tests to use the new dependency-injection test patterns.
  • Refactor

    • Authentication and form components now accept injectable dependencies for navigation and UI primitives.
    • Chain parameter logic consolidated into a single hook and provider nesting simplified (provider removed).
  • Performance

    • Settings/deposit queries cache longer for improved responsiveness.

✏️ Tip: You can customize this high-level summary in your review settings.

@stalniy stalniy requested a review from a team as a code owner December 20, 2025 05:29
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 20, 2025

Walkthrough

Auth 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

Cohort / File(s) Summary
Auth components (DI + tests)
apps/deploy-web/src/components/auth/AuthPage/AuthPage.tsx, apps/deploy-web/src/components/auth/AuthPage/AuthPage.spec.tsx, apps/deploy-web/src/components/auth/SignInForm/SignInForm.tsx, apps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsx, apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.tsx, apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsx, apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.tsx, apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsx
Introduced public DEPENDENCIES constants and a dependencies?: typeof DEPENDENCIES prop for components; replaced direct imports/usages with d.* (dependency-scoped) references; tests updated to inject dependencies (useRouter/useBackNav) instead of using TestContainerProvider services.
ChainParam context → hook migration
apps/deploy-web/src/context/ChainParamProvider/ChainParamProvider.tsx, apps/deploy-web/src/context/ChainParamProvider/index.ts, apps/deploy-web/src/hooks/useChainParam/useChainParam.tsx, apps/deploy-web/src/hooks/useChainParam/useChainParam.spec.tsx
Removed the ChainParamProvider context and re-exports; added a new useChainParam hook (exports: DEPENDENCIES, MinDeposit, ContextType, useChainParam) and accompanying tests that compute minDeposit from depositParams and usdcDenom.
Hook imports & router sourcing
apps/deploy-web/src/hooks/useBackNav.ts, apps/deploy-web/src/hooks/useLoginRequiredEventHandler.tsx, apps/deploy-web/src/hooks/useManagedEscrowFaqModal.tsx, apps/deploy-web/src/hooks/useWalletBalance.ts, apps/deploy-web/src/components/get-started/GetStartedStepper.tsx, apps/deploy-web/src/components/sdl/DeploymentMinimumEscrowAlertText.tsx, apps/deploy-web/src/components/shared/PrerequisiteList.tsx
Updated imports to consume the new useChainParam hook path; several hooks now obtain Next.js router via useRouter() instead of via the services container.
ServicesProvider / DI container
apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx
Added useMemo around container creation; changed createAppContainer to accept `Partial
App provider tree
apps/deploy-web/src/pages/_app.tsx
Removed ChainParamProvider from the app provider tree.
Query caching tweak
apps/deploy-web/src/queries/useSaveSettings.ts
Added ONE_HOUR_IN_MS and set staleTime and gcTime for deposit params query to one hour.
Test utilities
apps/deploy-web/tests/unit/mocks.tsx
MockComponents updated: names beginning with use produce hook-style (no implementation) mocks; other names use ComponentMock.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Pay attention to:
    • New DEPENDENCIES shapes and defaulting behavior in auth components (SignInForm, SignUpForm, SignUpButton, AuthPage).
    • Removal of ChainParamProvider and ensuring all imports/consumers use the new useChainParam.
    • ServicesProvider container signature changes and callers that previously expected router in the container.
    • Test changes switching from TestContainerProvider/router to injected dependencies (confirm mocks like useBackNav behave equivalently).

Possibly related PRs

Suggested reviewers

  • ygrishajev
  • baktun14

Poem

🐰 I nibbled through imports, hopped over the wire,

Swapped contexts for hooks and set DEPENDENCIES higher.
Routers now peek from hooks, not buried in a jar,
Tests mock a gentle hop back — light as a star.
Hooray — the burrow's tidy; time for a carrot-celebration 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: converting ChainParamContext from a context provider to a hook, which is the core refactoring work across multiple files.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/chain-param-context

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Dec 20, 2025

Codecov Report

❌ Patch coverage is 86.00000% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.90%. Comparing base (65d6f7e) to head (d2535bf).
⚠️ Report is 3 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
apps/deploy-web/src/hooks/useBackNav.ts 33.33% 2 Missing ⚠️
...loy-web/src/hooks/useLoginRequiredEventHandler.tsx 33.33% 2 Missing ⚠️
...b/src/components/get-started/GetStartedStepper.tsx 0.00% 1 Missing ⚠️
...omponents/sdl/DeploymentMinimumEscrowAlertText.tsx 0.00% 1 Missing ⚠️
...loy-web/src/components/shared/PrerequisiteList.tsx 0.00% 1 Missing ⚠️
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     
Flag Coverage Δ *Carryforward flag
api 80.20% <ø> (ø) Carriedforward from 65d6f7e
deploy-web 31.21% <86.00%> (+0.04%) ⬆️
log-collector ?
notifications 87.94% <ø> (ø) Carriedforward from 65d6f7e
provider-console 81.48% <ø> (ø) Carriedforward from 65d6f7e
provider-proxy 84.35% <ø> (ø) Carriedforward from 65d6f7e

*This pull request uses carry forward flags. Click here to find out more.

Files with missing lines Coverage Δ
...ploy-web/src/components/auth/AuthPage/AuthPage.tsx 88.33% <100.00%> (+0.40%) ⬆️
...-web/src/components/auth/SignInForm/SignInForm.tsx 87.50% <100.00%> (+0.54%) ⬆️
.../src/components/auth/SignUpButton/SignUpButton.tsx 100.00% <100.00%> (ø)
...-web/src/components/auth/SignUpForm/SignUpForm.tsx 100.00% <100.00%> (ø)
.../src/context/ServicesProvider/ServicesProvider.tsx 52.17% <100.00%> (-1.02%) ⬇️
...ploy-web/src/hooks/useChainParam/useChainParam.tsx 100.00% <100.00%> (ø)
.../deploy-web/src/hooks/useManagedEscrowFaqModal.tsx 53.33% <100.00%> (ø)
apps/deploy-web/src/hooks/useWalletBalance.ts 25.00% <100.00%> (ø)
apps/deploy-web/src/pages/_app.tsx 0.00% <ø> (ø)
apps/deploy-web/src/queries/useSaveSettings.ts 96.87% <100.00%> (+0.10%) ⬆️
... and 5 more

... and 59 files with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 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 useCallback hook on line 15 returns a function that references router and urlService (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: Missing authService in dependency array.

The redirectToSocialLogin callback uses authService.loginViaOauth but authService is 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 since Object.keys() always returns an array of strings.

Additionally, hooks mocked with jest.fn(undefined) will return undefined by 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 gcTime longer than staleTime (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 refetches
apps/deploy-web/src/hooks/useBackNav.ts (1)

10-16: Consider using router object directly in dependencies.

Using router.asPath causes the callback to be recreated on every navigation, even though router.back() and router.push() methods remain stable. The router object from useRouter() 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 Props interface references typeof DEPENDENCIES on line 24, but DEPENDENCIES is defined after Props on lines 27-36. While this works due to TypeScript's hoisting behavior, placing DEPENDENCIES before Props would 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 renaming ContextType since this is now a hook.

Since this was refactored from a context to a hook, the type name ContextType is now slightly misleading. A name like ChainParamResult or simply export the type inline would better reflect the current pattern.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 13498b5 and eb1c188.

📒 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 type any or cast to type any. 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.tsx
  • apps/deploy-web/src/queries/useSaveSettings.ts
  • apps/deploy-web/src/components/sdl/DeploymentMinimumEscrowAlertText.tsx
  • apps/deploy-web/src/hooks/useWalletBalance.ts
  • apps/deploy-web/src/hooks/useManagedEscrowFaqModal.tsx
  • apps/deploy-web/src/hooks/useBackNav.ts
  • apps/deploy-web/tests/unit/mocks.tsx
  • apps/deploy-web/src/components/shared/PrerequisiteList.tsx
  • apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsx
  • apps/deploy-web/src/hooks/useChainParam/useChainParam.tsx
  • apps/deploy-web/src/pages/_app.tsx
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsx
  • apps/deploy-web/src/components/auth/SignInForm/SignInForm.tsx
  • apps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsx
  • apps/deploy-web/src/hooks/useChainParam/useChainParam.spec.tsx
  • apps/deploy-web/src/components/auth/AuthPage/AuthPage.spec.tsx
  • apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.tsx
  • apps/deploy-web/src/hooks/useLoginRequiredEventHandler.tsx
  • apps/deploy-web/src/components/auth/AuthPage/AuthPage.tsx
  • apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx
  • apps/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, use jest-mock-extended to create mocks and pass mocks as dependencies to the service under test

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.

**/*.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
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.tsx
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsx
  • apps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsx
  • apps/deploy-web/src/hooks/useChainParam/useChainParam.spec.tsx
  • apps/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 queryBy methods instead of getBy methods in test expectations

Files:

  • apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsx
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsx
  • apps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsx
  • apps/deploy-web/src/hooks/useChainParam/useChainParam.spec.tsx
  • apps/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.tsx
  • apps/deploy-web/src/components/auth/SignInForm/SignInForm.tsx
  • apps/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.tsx
  • apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsx
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsx
  • apps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsx
  • apps/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.tsx
  • apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsx
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsx
  • apps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsx
  • apps/deploy-web/src/hooks/useChainParam/useChainParam.spec.tsx
  • apps/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.tsx
  • apps/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.tsx
  • apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsx
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsx
  • apps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsx
  • apps/deploy-web/src/hooks/useChainParam/useChainParam.spec.tsx
  • apps/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.tsx
  • apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsx
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsx
  • apps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsx
  • 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-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.tsx
  • apps/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 ChainParamContext to a hook. All old imports from @src/context/ChainParamProvider have been removed, and the new hook file exists at @src/hooks/useChainParam/useChainParam with 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 DEPENDENCIES to enable dependency injection for the component under test.


62-81: LGTM! Test setup follows coding guidelines.

The setup function 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 dependencies prop
apps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsx (2)

5-5: LGTM! Consistent dependency injection pattern.

The test correctly imports and uses DEPENDENCIES to enable dependency injection, consistent with the pattern used across other auth component tests.


54-73: LGTM! Test setup follows coding guidelines.

The setup function properly follows all coding guidelines and correctly injects the goBack mock via the dependencies prop, 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 DEPENDENCIES object 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 DEPENDENCIES to enable router injection during testing.


68-72: LGTM! Correct test dependency injection.

The test properly injects a mocked router via the dependencies prop while preserving the DEPENDENCIES defaults, 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 ChainParamProvider from the provider tree correctly completes the refactoring from context-based to hook-based architecture. Components now access chain parameters directly via the useChainParam hook 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 router via services to injecting useRouter through the dependencies prop. 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.name in describe block
  • Uses setup function at the bottom of describe block with inline parameter type
  • Uses jest-mock-extended for mocking instead of jest.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 of useServices(), enabling better testability. The DEPENDENCIES export correctly includes both useSearchParams and useRouter.

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 SignUpForm and other auth components in the PR.

apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx (1)

25-28: LGTM on the memoization approach.

The useMemo correctly 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 DEPENDENCIES is consistent with the approach used in other components (SignUpButton, SignInForm, AuthPage). The useMemo correctly captures depositParams and usdcDenom as 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 DEPENDENCIES constant follows the same pattern established in SignInForm, SignUpButton, and AuthPage, 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.

@stalniy stalniy force-pushed the refactor/chain-param-context branch from eb1c188 to fd9ec66 Compare December 22, 2025 14:43
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (4)
apps/deploy-web/src/hooks/useBackNav.ts (1)

10-16: Consider using router instead of router.asPath in the dependency array.

The callback depends on router.back() and router.push() methods, not specifically on router.asPath. While router.asPath may work as an optimization to reduce unnecessary recreations, using the router object 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, so typeof 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

📥 Commits

Reviewing files that changed from the base of the PR and between eb1c188 and fd9ec66.

📒 Files selected for processing (23)
  • apps/deploy-web/src/components/auth/AuthPage/AuthPage.spec.tsx
  • apps/deploy-web/src/components/auth/AuthPage/AuthPage.tsx
  • apps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsx
  • apps/deploy-web/src/components/auth/SignInForm/SignInForm.tsx
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsx
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.tsx
  • apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsx
  • apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.tsx
  • apps/deploy-web/src/components/get-started/GetStartedStepper.tsx
  • apps/deploy-web/src/components/sdl/DeploymentMinimumEscrowAlertText.tsx
  • apps/deploy-web/src/components/shared/PrerequisiteList.tsx
  • apps/deploy-web/src/context/ChainParamProvider/ChainParamProvider.tsx
  • apps/deploy-web/src/context/ChainParamProvider/index.ts
  • apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx
  • apps/deploy-web/src/hooks/useBackNav.ts
  • apps/deploy-web/src/hooks/useChainParam/useChainParam.spec.tsx
  • apps/deploy-web/src/hooks/useChainParam/useChainParam.tsx
  • apps/deploy-web/src/hooks/useLoginRequiredEventHandler.tsx
  • apps/deploy-web/src/hooks/useManagedEscrowFaqModal.tsx
  • apps/deploy-web/src/hooks/useWalletBalance.ts
  • apps/deploy-web/src/pages/_app.tsx
  • apps/deploy-web/src/queries/useSaveSettings.ts
  • apps/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 type any or cast to type any. 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.tsx
  • apps/deploy-web/src/hooks/useBackNav.ts
  • apps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsx
  • apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsx
  • apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx
  • apps/deploy-web/src/hooks/useChainParam/useChainParam.spec.tsx
  • apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.tsx
  • apps/deploy-web/src/pages/_app.tsx
  • apps/deploy-web/tests/unit/mocks.tsx
  • apps/deploy-web/src/hooks/useChainParam/useChainParam.tsx
  • apps/deploy-web/src/hooks/useManagedEscrowFaqModal.tsx
  • apps/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, use jest-mock-extended to create mocks and pass mocks as dependencies to the service under test

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.

**/*.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
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.tsx
  • apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsx
  • apps/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 queryBy methods instead of getBy methods in test expectations

Files:

  • apps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsx
  • apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsx
  • apps/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.tsx
  • apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.tsx
  • apps/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.tsx
  • apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsx
  • apps/deploy-web/src/hooks/useChainParam/useChainParam.spec.tsx
  • apps/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.tsx
  • apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsx
  • apps/deploy-web/src/hooks/useChainParam/useChainParam.spec.tsx
  • apps/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.tsx
  • apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsx
  • apps/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.tsx
  • apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsx
  • apps/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.tsx
  • apps/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.tsx
  • apps/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 ChainParamProvider from 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.name in the describe block
  • Uses jest-mock-extended for mocking instead of jest.mock()
  • setup function is at the bottom of the describe block with proper structure
  • Tests cover key scenarios: undefined params, conversion, missing denom, and enabled flag propagation
apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsx (1)

1-82: LGTM!

Test suite properly refactored to use the DI pattern:

  • Uses SignUpForm.name in the root describe
  • Imports and spreads DEPENDENCIES with mock overrides
  • Uses queryBy methods in expectations (lines 38, 58, 59)
  • setup function at bottom with proper structure
  • No jest.mock() used
apps/deploy-web/src/components/auth/SignInForm/SignInForm.tsx (1)

27-46: LGTM!

Clean implementation of the dependency injection pattern:

  • DEPENDENCIES constant properly exports UI components and hooks
  • Component signature accepts optional dependencies prop with correct typing
  • Hook usage (useForm, useBackNav) correctly sourced from dependencies
  • Consistent with the DI pattern used in SignUpForm and SignUpButton
apps/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 useBackNav mock through the dependencies prop and validates the navigation behavior. The custom rerender helper 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 rerender helper 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 useMemo and the simplification of AppDIContainer to use ReturnType improves 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> | undefined makes 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.log statement at these lines, but it's no longer present in the current code. This issue has been resolved.

@stalniy stalniy force-pushed the refactor/chain-param-context branch from fd9ec66 to d2535bf Compare December 22, 2025 17:28
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 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 router and urlService, 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.setSettings and settingsState.refreshNodeStatuses, which are used within the memoized container (lines 66 and 84). While refreshNodeStatuses is stable via useCallback, setSettings may 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 staleTime and gcTime to 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 using getBy instead of queryBy for toBeInTheDocument() checks.

Based on learnings, using getBy methods for element presence checks with toBeInTheDocument() provides better debugging information. When an element is not found, getBy throws an error and shows the DOM state, whereas queryBy returns 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 queryBy for negative assertions like not.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 using getBy for toBeInTheDocument() check.

Line 30 uses queryBy for an element presence check with toBeInTheDocument(), while Line 51 correctly uses getBy. For consistency and better debugging information when elements are not found, consider using getBy here 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

📥 Commits

Reviewing files that changed from the base of the PR and between fd9ec66 and d2535bf.

📒 Files selected for processing (23)
  • apps/deploy-web/src/components/auth/AuthPage/AuthPage.spec.tsx
  • apps/deploy-web/src/components/auth/AuthPage/AuthPage.tsx
  • apps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsx
  • apps/deploy-web/src/components/auth/SignInForm/SignInForm.tsx
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.spec.tsx
  • apps/deploy-web/src/components/auth/SignUpButton/SignUpButton.tsx
  • apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsx
  • apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.tsx
  • apps/deploy-web/src/components/get-started/GetStartedStepper.tsx
  • apps/deploy-web/src/components/sdl/DeploymentMinimumEscrowAlertText.tsx
  • apps/deploy-web/src/components/shared/PrerequisiteList.tsx
  • apps/deploy-web/src/context/ChainParamProvider/ChainParamProvider.tsx
  • apps/deploy-web/src/context/ChainParamProvider/index.ts
  • apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx
  • apps/deploy-web/src/hooks/useBackNav.ts
  • apps/deploy-web/src/hooks/useChainParam/useChainParam.spec.tsx
  • apps/deploy-web/src/hooks/useChainParam/useChainParam.tsx
  • apps/deploy-web/src/hooks/useLoginRequiredEventHandler.tsx
  • apps/deploy-web/src/hooks/useManagedEscrowFaqModal.tsx
  • apps/deploy-web/src/hooks/useWalletBalance.ts
  • apps/deploy-web/src/pages/_app.tsx
  • apps/deploy-web/src/queries/useSaveSettings.ts
  • apps/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 type any or cast to type any. 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.tsx
  • apps/deploy-web/src/components/get-started/GetStartedStepper.tsx
  • apps/deploy-web/src/hooks/useBackNav.ts
  • apps/deploy-web/src/components/auth/AuthPage/AuthPage.spec.tsx
  • apps/deploy-web/src/hooks/useLoginRequiredEventHandler.tsx
  • apps/deploy-web/src/context/ServicesProvider/ServicesProvider.tsx
  • apps/deploy-web/src/components/shared/PrerequisiteList.tsx
  • apps/deploy-web/src/queries/useSaveSettings.ts
  • apps/deploy-web/src/components/auth/SignInForm/SignInForm.tsx
  • apps/deploy-web/src/components/auth/SignInForm/SignInForm.spec.tsx
  • apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.tsx
  • apps/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, use jest-mock-extended to create mocks and pass mocks as dependencies to the service under test

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.

**/*.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
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.tsx
  • apps/deploy-web/src/components/auth/AuthPage/AuthPage.spec.tsx
  • apps/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 queryBy methods instead of getBy methods in test expectations

Files:

  • apps/deploy-web/src/components/auth/SignUpForm/SignUpForm.spec.tsx
  • apps/deploy-web/src/components/auth/AuthPage/AuthPage.spec.tsx
  • apps/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.tsx
  • apps/deploy-web/src/components/auth/AuthPage/AuthPage.spec.tsx
  • apps/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.tsx
  • apps/deploy-web/src/components/auth/AuthPage/AuthPage.spec.tsx
  • apps/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.tsx
  • apps/deploy-web/src/components/auth/AuthPage/AuthPage.spec.tsx
  • apps/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.tsx
  • apps/deploy-web/src/components/auth/AuthPage/AuthPage.spec.tsx
  • apps/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.tsx
  • apps/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.tsx
  • apps/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 useRouter hook 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 useMemo to 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 AppDIContainer type now cleanly derives from the return type of createAppContainer, ensuring type consistency without manual maintenance.


38-38: LGTM: Flexible signature improves testability.

The updated signature accepting Partial<T> | undefined enables partial service mocking in tests while maintaining type safety through the generic constraint T 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: () => router injection 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/ChainParamProvider path 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 useRouter hook, improving separation of concerns. The dependency array change from router to router.asPath is an improvement—since Next.js mutates the router object in place, using router.asPath ensures 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 goBack mock via the dependencies prop. 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. The DEPENDENCIES constant 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. The goBack mock 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. The DEPENDENCIES constant 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

@stalniy stalniy merged commit 51816d5 into main Dec 22, 2025
65 checks passed
@stalniy stalniy deleted the refactor/chain-param-context branch December 22, 2025 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments