fix: disable automatic retries for login user mutation#9576
Conversation
…matic retries on login user mutation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughSets a default retry: false for the login mutation hook, placed before spreading user-provided options; existing onSettled behavior and refetch calls remain as-is. No exported signatures change. Changes
Sequence Diagram(s)sequenceDiagram
participant UI as UI
participant Hook as useLoginUser
participant API as Auth API
participant Cache as Query Cache
Note over Hook: Mutation configured with retry: false (no auto-retries)
UI->>Hook: mutate(credentials)
Hook->>API: POST /login
alt success
API-->>Hook: 200 OK (tokens/user)
Hook->>Cache: onSettled → refetch folders, tags
Hook-->>UI: settled (success)
else error
API-->>Hook: 4xx/5xx
Note over Hook: No automatic retry
Hook->>Cache: onSettled (still runs)
Hook-->>UI: settled (error)
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes ✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
Status, Documentation and Community
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/frontend/src/controllers/API/queries/auth/use-post-login-user.ts (2)
34-37: Refetch only on success, not onSettledAvoid refetching folders/tags after failed login attempts.
- onSettled: () => { + onSuccess: () => { queryClient.refetchQueries({ queryKey: ["useGetFolders"] }); queryClient.refetchQueries({ queryKey: ["useGetTags"] }); - }, + },
31-36: Ensure retry is always disabled by reordering optionsCurrently,
retry: falseis specified before spreading...options, which means a caller can re-enable retries by passingretryin their options. To guarantee that retries remain disabled, moveretry: falseafter the spread so it cannot be overridden.• File:
src/frontend/src/controllers/API/queries/auth/use-post-login-user.ts
• Lines: around themutatecall’s options objectSuggested diff:
- { - retry: false, - ...options, - onSettled: () => { + { + ...options, + retry: false, + onSettled: () => { queryClient.refetchQueries({ queryKey: ["useGetFolders"] }); queryClient.refetchQueries({ queryKey: ["useGetTags"] });
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
src/frontend/src/controllers/API/queries/auth/use-post-login-user.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/frontend/src/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursor/rules/frontend_development.mdc)
src/frontend/src/**/*.{ts,tsx,js,jsx}: All frontend TypeScript and JavaScript code should be located under src/frontend/src/ and organized into components, pages, icons, stores, types, utils, hooks, services, and assets directories as per the specified directory layout.
Use React 18 with TypeScript for all UI components in the frontend.
Format all TypeScript and JavaScript code using the make format_frontend command.
Lint all TypeScript and JavaScript code using the make lint command.
Files:
src/frontend/src/controllers/API/queries/auth/use-post-login-user.ts
🔇 Additional comments (2)
src/frontend/src/controllers/API/queries/auth/use-post-login-user.ts (2)
31-36: Disabling retries by default is good; placement lets callers opt back inAdding retry: false here clearly communicates intent and prevents accidental multi-attempts; since ...options follows, callers can still override if needed. Note: mutations don’t retry by default in TanStack Query, but an explicit false is useful if global mutation defaults enable retries. (tanstack.com)
31-36: No React Query persistence is configuredI’ve confirmed that the application’s
QueryClientis instantiated without any persistence or offline plugins and that there is no usage ofPersistQueryClientProvider,resumePausedMutations, or similar APIs anywhere in the codebase. Therefore, failed login mutations cannot be replayed on reconnect, and settingretry: falseis sufficient for our auth flow.– In
src/frontend/src/contexts/index.tsx,new QueryClient()is used directly withQueryClientProviderand no persister
– No references toPersistQueryClientProvider,createSyncStoragePersister, orresumePausedMutationswere found
– All mutation defaults remain in-memory only, so offline resumes are not possibleThis concern can be safely resolved as there is no persistence layer for React Query in the app.
Codecov Report✅ All modified and coverable lines are covered by tests. ❌ Your project status has failed because the head coverage (5.81%) is below the target coverage (10.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #9576 +/- ##
==========================================
- Coverage 34.69% 34.69% -0.01%
==========================================
Files 1209 1209
Lines 57115 57110 -5
Branches 5419 5419
==========================================
- Hits 19818 19814 -4
+ Misses 37153 37152 -1
Partials 144 144
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|



Disable automatic retries for login user mutation to prevent multiple authentication attempts and potential rate limiting issues.
Changed: Set
retry: falseinuse-post-login-user.tsSummary by CodeRabbit