Skip to content

Conversation

@codeunia-dev
Copy link
Owner

@codeunia-dev codeunia-dev commented Sep 15, 2025

Summary by CodeRabbit

  • New Features
    • Post-auth redirects now preserve the user’s original destination via a returnUrl parameter, improving continuity after login and profile completion.
    • Profile completion flow respects an optional returnUrl, sending users back to where they intended to go once complete.
    • Safe URL encoding applied to returnUrl to prevent malformed redirects.
    • Sensible default remains in place when no returnUrl is provided.

Deepak Pandey added 2 commits September 15, 2025 13:25
- Make username availability check more lenient on database errors
- Allow form submission when username check fails (assume available)
- Fix submit button disabled state to only block when username is definitely unavailable
- Improve error handling for 406 Supabase errors
- Ensure form can be submitted even with database connectivity issues
- Pass returnUrl parameter from OAuth callback to complete-profile page
- Update complete-profile page to handle returnUrl parameter
- Redirect users back to their original destination after profile completion
- Ensures users land on the page they were trying to access before auth
@vercel
Copy link

vercel bot commented Sep 15, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
codeunia Building Building Preview Comment Sep 15, 2025 7:59am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 15, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Redirects from the auth callback to the complete-profile page now include a returnUrl query param. The complete-profile page reads this param and uses it for subsequent redirects, replacing hard-coded destinations. Initialization adjustments introduce searchParams and remove a duplicate router instance. Exported/public entities remain unchanged.

Changes

Cohort / File(s) Summary of Changes
OAuth Callback Redirect Propagation
app/auth/callback/page.tsx
Updated all redirects to /complete-profile to append ?returnUrl=${encodeURIComponent(returnUrl)}. No other navigation or error handling logic changed.
Complete Profile Dynamic Return
app/complete-profile/page.tsx
Added useSearchParams; initialized returnUrl (default /protected/dashboard). Replaced hard-coded redirects with navigation to returnUrl. Removed duplicate router initialization. No API/signature changes.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    actor U as User
    participant OP as OAuth Provider
    participant AC as Auth Callback Page
    participant CP as Complete Profile Page
    participant APP as App (Protected Area)

    U->>OP: Authenticate
    OP-->>AC: Redirect with code/state (+ optional returnUrl)
    AC->>AC: Process OAuth + profile checks
    alt Profile incomplete or needs retry
        AC->>CP: router.replace(/complete-profile?returnUrl=ENC(returnUrl))
        note right of AC: returnUrl preserved via query param
    else Profile complete
        AC->>APP: Continue normal flow (unchanged)
    end

    CP->>CP: Read searchParams, derive returnUrl (default /protected/dashboard)
    alt Existing profile already complete
        CP->>APP: router.replace(returnUrl)
    else User completes profile
        CP->>APP: router.replace(returnUrl)
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

A rabbit hops through routes so bright,
With returnUrl tucked snug and tight.
From callback burrow to profile glen,
We bounce back home, right where we’ve been.
Encode, replace—then off we dash,
To dashboards warm, in one quick flash. 🐇✨

✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/oauth-profile-completion

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 36dad0f and 97d81ad.

📒 Files selected for processing (2)
  • app/auth/callback/page.tsx (5 hunks)
  • app/complete-profile/page.tsx (4 hunks)

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

@codeunia-dev codeunia-dev merged commit 89457e2 into main Sep 15, 2025
2 of 4 checks passed
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