Skip to content

fix: implement robust route check for onboarding status and HashRouter URL redirect (Resolves #217)#258

Merged
indresh404 merged 1 commit into
indresh404:mainfrom
Adi-Marathe:fix/issue-217-onboarding-route-bypass
Jun 3, 2026
Merged

fix: implement robust route check for onboarding status and HashRouter URL redirect (Resolves #217)#258
indresh404 merged 1 commit into
indresh404:mainfrom
Adi-Marathe:fix/issue-217-onboarding-route-bypass

Conversation

@Adi-Marathe
Copy link
Copy Markdown
Contributor

Description:

What does this PR do?
This PR resolves an issue where a user who had already fully onboarded could manually navigate to the /onboarding route by typing it into the browser's URL bar, allowing them to re-submit their onboarding form and reset their referral code and initial scores.

How was it fixed?
This PR implements a two-part fix to address both the routing logic and the visual URL bugs:

  1. Strict Route Guard: Updated the OnboardingRoute in src/routes/AppRoutes.jsx to explicitly check if userData.onboardingStatus === "complete". If a user is already fully onboarded, the guard now instantly catches this and redirects them to the /dashboard.
  2. HashRouter Path Interceptor: Added a useEffect inside src/App.jsx that detects when a user manually types a path like localhost:5173/onboarding (without the hash) and forces a hard window.location.replace to properly map them to the hash route (/#/onboarding). This ensures React Router correctly processes the URL and triggers the route guards, preventing users from getting stuck with misleading URLs while viewing the Home Page or Dashboard.

Acceptance Criteria Met:

  • Re-navigating to /onboarding strictly redirects fully onboarded users to /dashboard.
  • Typing /onboarding manually correctly evaluates the route using the HashRouter instead of ignoring it.

Visual Proof:

RankerHub-.-Gamified-Developer-Leaderboard.1.mp4

Closes: #217

@Adi-Marathe Adi-Marathe requested a review from indresh404 as a code owner June 3, 2026 13:23
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 3, 2026

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

Project Deployment Actions Updated (UTC)
ranker-hub Ready Ready Preview, Comment Jun 3, 2026 1:23pm

@github-actions github-actions Bot added bug Something isn't working enhancement New feature or request frontend Frontend related changes (HTML/CSS/JS/React) gssoc GirlScript Summer of Code gssoc26 GirlScript Summer of Code 2026 nsoc NSoC NSoC'26 NSoC 2026 pending-review PR is pending review labels Jun 3, 2026
@indresh404 indresh404 merged commit 30c8d15 into indresh404:main Jun 3, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request frontend Frontend related changes (HTML/CSS/JS/React) gssoc GirlScript Summer of Code gssoc26 GirlScript Summer of Code 2026 level3 nsoc NSoC NSoC'26 NSoC 2026 pending-review PR is pending review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Router Guard Bypass for Already Onboarded Users

2 participants