fix: remove console debug statements and fix formatting#108
fix: remove console debug statements and fix formatting#108shrutu0929 wants to merge 2 commits intoRefactron-ai:mainfrom
Conversation
|
Someone is attempting to deploy a commit to the omsherikar's projects Team on Vercel. A member of the Team first needs to authorize it. |
📝 WalkthroughWalkthroughRemoved debug console.log statements across UI components, hooks, and a service; also adjusted a CI workflow trigger and added an explicit checkout step. No functional or control-flow changes. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
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. Comment |
There was a problem hiding this comment.
👋 Welcome to Refactron! Thank you for opening your first pull request.
A maintainer will review your changes soon. Please ensure:
- All CI checks pass
- Your code follows our style guidelines
- Tests are included if applicable
- Documentation is updated if needed
Check out our Contributing Guide for more information.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/hooks/useAuth.tsx`:
- Around line 194-208: The current branch reads pending_device_code from
localStorage then navigates to '/device/connect' using navigation state which is
lost on page refresh; change the handoff to use a URL query parameter instead
(e.g. navigate to '/device/connect?device_code=...') so DeviceConnect (and the
existing LoginForm query-based flow) can rehydrate it from the URL after a
refresh; keep the localStorage key 'pending_device_code' unchanged (do not
remove it here), update the navigate(...) call in useAuth (the branch around
localStorage.getItem('pending_device_code')) to append the device code as a
query param rather than using state, and ensure DeviceConnect.tsx reads the
device code from the query string on mount instead of relying solely on
navigation state.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 95ed2e14-3333-49f9-9298-fbabd20b63c9
📒 Files selected for processing (9)
src/components/Dashboard.tsxsrc/components/DeviceConnect.tsxsrc/components/EarlyAccessForm.tsxsrc/components/LoginForm.tsxsrc/components/ProtectedRoute.tsxsrc/components/VerifyEmail.tsxsrc/hooks/useAuth.tsxsrc/hooks/useCookieConsent.tssrc/services/apiKey.service.ts
💤 Files with no reviewable changes (2)
- src/components/EarlyAccessForm.tsx
- src/hooks/useCookieConsent.ts
| // Check if there's a pending device code | ||
| const deviceCode = localStorage.getItem('pending_device_code'); | ||
| console.log( | ||
| '[completeOnboarding] Device code from localStorage:', | ||
| deviceCode | ||
| ); | ||
|
|
||
|
|
||
| if (deviceCode) { | ||
| // Navigate with state (cleanup will happen in DeviceConnect after mount) | ||
| console.log( | ||
| '[completeOnboarding] Navigating to device connect with code via state' | ||
| ); // Don't remove yet - ProtectedRoute needs to detect this! | ||
| // Don't remove yet - ProtectedRoute needs to detect this! | ||
| // localStorage.removeItem('pending_device_code'); | ||
| navigate('/device/connect', { | ||
| state: { deviceCode }, | ||
| replace: true, | ||
| }); | ||
| } else { | ||
| console.log( | ||
| '[completeOnboarding] No device code found, redirecting to dashboard' | ||
| ); | ||
|
|
||
| navigate('/dashboard'); |
There was a problem hiding this comment.
Preserve the device code across refreshes.
This branch reads pending_device_code from localStorage, then forwards it to /device/connect as navigation-only state. src/components/DeviceConnect.tsx clears pending_device_code on mount and does not rehydrate from storage, so a reload on the connect page drops the code and breaks the CLI authorization flow. Reusing the query-param handoff that src/components/LoginForm.tsx already uses avoids that failure mode.
🔁 Suggested change
if (deviceCode) {
// Navigate with state (cleanup will happen in DeviceConnect after mount)
// Don't remove yet - ProtectedRoute needs to detect this!
// localStorage.removeItem('pending_device_code');
- navigate('/device/connect', {
- state: { deviceCode },
- replace: true,
- });
+ navigate(`/device/connect?code=${encodeURIComponent(deviceCode)}`, {
+ replace: true,
+ });
} else {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/hooks/useAuth.tsx` around lines 194 - 208, The current branch reads
pending_device_code from localStorage then navigates to '/device/connect' using
navigation state which is lost on page refresh; change the handoff to use a URL
query parameter instead (e.g. navigate to '/device/connect?device_code=...') so
DeviceConnect (and the existing LoginForm query-based flow) can rehydrate it
from the URL after a refresh; keep the localStorage key 'pending_device_code'
unchanged (do not remove it here), update the navigate(...) call in useAuth (the
branch around localStorage.getItem('pending_device_code')) to append the device
code as a query param rather than using state, and ensure DeviceConnect.tsx
reads the device code from the query string on mount instead of relying solely
on navigation state.
This Pull Request removes unnecessary console.log trace and debug statements scattered across various frontend components and hooks (including
Dashboard.tsx
,
useAuth.tsx
,
LoginForm.tsx
,
DeviceConnect.tsx
, and
VerifyEmail.tsx
). These temporary logs were cluttering the output console in production environments without providing user-facing value. Essential debug logs inside utilities like
usePerformanceMonitoring
and
analytics.ts
were strictly preserved since they are already conditionally wrapped to execute only in local development (NODE_ENV === 'development'), and legitimate console.error logs were intentionally kept intact for reliable debugging.
Summary by CodeRabbit