Conversation
📝 WalkthroughWalkthroughRemoved the render-prop Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧹 Recent nitpick comments
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (7)
💤 Files with no reviewable changes (1)
🚧 Files skipped from review as they are similar to previous changes (4)
🧰 Additional context used📓 Path-based instructions (1)**/*.{ts,tsx,js}📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Files:
🧠 Learnings (2)📚 Learning: 2025-06-05T21:07:51.985ZApplied to files:
📚 Learning: 2025-06-19T16:00:05.428ZApplied to files:
🧬 Code graph analysis (2)apps/deploy-web/src/hooks/useCustomUser.ts (1)
apps/deploy-web/src/components/user/UserSettingsForm.tsx (1)
⏰ 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)
🔇 Additional comments (3)
✏️ Tip: You can disable this entire section by setting Comment |
Codecov Report❌ Patch coverage is ❌ Your patch status has failed because the patch coverage (7.14%) is below the target coverage (50.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #2492 +/- ##
==========================================
- Coverage 51.00% 50.71% -0.29%
==========================================
Files 1065 1054 -11
Lines 29459 29103 -356
Branches 6549 6506 -43
==========================================
- Hits 15026 14761 -265
+ Misses 14213 14122 -91
Partials 220 220
*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 (1)
apps/deploy-web/src/queries/useTemplateQuery.tsx (1)
13-13: RemoveanyfromUseQueryOptionsgenerics (coding guideline).
UseQueryOptions<..., any, ...>on lines 13 and 22 violates the "never useany" rule. The third generic parameter (TData) should match the actual return type used in the correspondinguseQuerycall, which isITemplate[]andPartial<ITemplate>[]respectively.Proposed fix (replace `any` with concrete types)
-export function useUserTemplates(username: string, options?: Omit<UseQueryOptions<ITemplate[], Error, any, QueryKey>, "queryKey" | "queryFn">) { +export function useUserTemplates( + username: string, + options?: Omit<UseQueryOptions<ITemplate[], Error, ITemplate[], QueryKey>, "queryKey" | "queryFn"> +) { const { consoleApiHttpClient } = useServices(); return useQuery<ITemplate[], Error>({ queryKey: QueryKeys.getUserTemplatesKey(username), queryFn: () => consoleApiHttpClient.get<ITemplate[]>(`/user/templates/${username}`).then(response => response.data), ...options }); } -export function useUserFavoriteTemplates(options?: Omit<UseQueryOptions<Partial<ITemplate>[], Error, any, QueryKey>, "queryKey" | "queryFn">) { +export function useUserFavoriteTemplates( + options?: Omit<UseQueryOptions<Partial<ITemplate>[], Error, Partial<ITemplate>[], QueryKey>, "queryKey" | "queryFn"> +) { const { user } = useCustomUser(); const { consoleApiHttpClient } = useServices(); return useQuery<Partial<ITemplate>[], Error>({ queryKey: QueryKeys.getUserFavoriteTemplatesKey(user?.sub || ""), queryFn: () => consoleApiHttpClient.get<Partial<ITemplate>[]>(`/user/favoriteTemplates`).then(response => response.data), ...options }); }
🤖 Fix all issues with AI agents
In `@apps/deploy-web/src/pages/user/api-keys/index.tsx`:
- Around line 9-16: The delete flow currently passes a possibly empty string
into useDeleteApiKey via useDeleteApiKey(apiKeyToDelete?.id ?? "", ...), which
can cause deleteApiKey() to be invoked with an empty id; change the flow to
avoid wiring an empty id and to defensively guard the action: initialize
useDeleteApiKey with undefined/null when there is no id (e.g.,
useDeleteApiKey(apiKeyToDelete?.id ?? undefined, ...) or delay calling the hook
until id exists), and before invoking deleteApiKey() add a runtime check that
ensures the id is truthy (e.g., if (!apiKeyToDelete?.id) return) so
deleteApiKey() is never called with an empty string; update the handlers where
deleteApiKey() is called (references: useDeleteApiKey, apiKeyToDelete?.id,
deleteApiKey) accordingly.
🧹 Nitpick comments (2)
apps/deploy-web/src/pages/user/settings/index.tsx (1)
1-13: Guard-wrapped page is fine;if (!user) return nullshould be unreachable whencanVisitis true.Given
Guard(UserSettingsPage, useIsRegisteredUser)andcanVisit: !!user?.userId, the null-return path should not happen; consider replacing with an explicit fallback (or remove it) if you want to avoid silent blank renders in edge cases.apps/deploy-web/src/components/user/UserSettingsForm.tsx (1)
31-31: Inconsistent null checks foruserprop.The prop type declares
user: CustomUserProfileas required (non-nullable), but the component still contains defensive checks likeif (user)on line 62 and optional chaininguser?.usernamein the dependency array on line 70. Meanwhile, lines 100 and 105 accessuser.usernameanduser.emaildirectly without guards.If the Guard pattern ensures
useris always defined when this component renders, consider removing the redundant null checks for consistency:♻️ Suggested cleanup
useEffect(() => { - if (user) { - setValue("username", user.username || ""); - setValue("subscribedToNewsletter", user.subscribedToNewsletter); - setValue("bio", user.bio); - setValue("youtubeUsername", user.youtubeUsername); - setValue("twitterUsername", user.twitterUsername); - setValue("githubUsername", user.githubUsername); - } - }, [user?.username, user?.subscribedToNewsletter, user?.bio, user?.youtubeUsername, user?.twitterUsername, user?.githubUsername]); + setValue("username", user.username || ""); + setValue("subscribedToNewsletter", user.subscribedToNewsletter); + setValue("bio", user.bio); + setValue("youtubeUsername", user.youtubeUsername); + setValue("twitterUsername", user.twitterUsername); + setValue("githubUsername", user.githubUsername); + }, [user.username, user.subscribedToNewsletter, user.bio, user.youtubeUsername, user.twitterUsername, user.githubUsername, setValue]);Note: The same applies to lines 73 and 86 where
useris checked or accessed with optional chaining.Also applies to: 61-70
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
apps/deploy-web/src/components/user/RequiredUserContainer.tsxapps/deploy-web/src/components/user/UserSettingsForm.tsxapps/deploy-web/src/hooks/useCustomUser.tsapps/deploy-web/src/hooks/useUser.tsapps/deploy-web/src/pages/user/api-keys/index.tsxapps/deploy-web/src/pages/user/settings/index.tsxapps/deploy-web/src/queries/useTemplateQuery.tsx
💤 Files with no reviewable changes (1)
- apps/deploy-web/src/components/user/RequiredUserContainer.tsx
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{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/hooks/useUser.tsapps/deploy-web/src/hooks/useCustomUser.tsapps/deploy-web/src/components/user/UserSettingsForm.tsxapps/deploy-web/src/queries/useTemplateQuery.tsxapps/deploy-web/src/pages/user/api-keys/index.tsxapps/deploy-web/src/pages/user/settings/index.tsx
🧠 Learnings (4)
📚 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/user/UserSettingsForm.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/user/UserSettingsForm.tsx
📚 Learning: 2025-09-10T08:40:53.104Z
Learnt from: stalniy
Repo: akash-network/console PR: 1892
File: apps/deploy-web/src/components/new-deployment/BidCountdownTimer.tsx:20-31
Timestamp: 2025-09-10T08:40:53.104Z
Learning: In TanStack Query v5, the onSuccess and onError callbacks were removed from useQuery options. Instead, use useEffect with the data as a dependency to handle side effects when query data changes.
Applied to files:
apps/deploy-web/src/queries/useTemplateQuery.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/queries/useTemplateQuery.tsx
🧬 Code graph analysis (4)
apps/deploy-web/src/hooks/useCustomUser.ts (1)
apps/deploy-web/src/types/user.ts (1)
CustomUserProfile(19-19)
apps/deploy-web/src/components/user/UserSettingsForm.tsx (1)
apps/deploy-web/src/types/user.ts (1)
CustomUserProfile(19-19)
apps/deploy-web/src/pages/user/api-keys/index.tsx (2)
apps/deploy-web/src/hoc/guard/guard.hoc.tsx (1)
Guard(9-29)apps/deploy-web/src/hooks/useUser.ts (1)
useIsRegisteredUser(22-29)
apps/deploy-web/src/pages/user/settings/index.tsx (2)
apps/deploy-web/src/hooks/useUser.ts (1)
useUser(6-20)apps/deploy-web/src/components/user/UserSettingsForm.tsx (1)
UserSettingsForm(31-199)
⏰ 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 (6)
apps/deploy-web/src/hooks/useUser.ts (1)
6-10: Wideneduser+ optional chaining incanVisitis consistent with guarded pages.The
CustomUserProfile | undefinedreturn type and!!user?.userIdcheck match the new Guard-based gating pattern.Also applies to: 22-28
apps/deploy-web/src/queries/useTemplateQuery.tsx (1)
76-85: Good: guard cache update behinduser?.usernameand avoid optional key parts.This prevents
getUserTemplatesKey()from receiving an empty/undefined username and makes the cache update conditional on a valid key.apps/deploy-web/src/pages/user/settings/index.tsx (1)
15-18: GSSP route annotation looks consistent with other guarded pages.Adding
route: "/user/settings"is a clean way to preserve guard context.apps/deploy-web/src/pages/user/api-keys/index.tsx (1)
40-52: Passing combinedisLoading+ deletion props intoApiKeyListis a clear improvement.
Layout isLoading={isLoading}plusisDeleting/apiKeyToDeleteplumbing makes the UI state easier to reason about.apps/deploy-web/src/components/user/UserSettingsForm.tsx (2)
1-1: LGTM!Using
import typefor theFCtype is the correct approach for type-only imports.
15-15: LGTM!Type-only imports for
CustomUserProfileandUserSettingsare appropriate and both types are used in the component.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
a71e2af to
e97cad5
Compare
Why
bug
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.