fix: implement robust route check for onboarding status and HashRouter URL redirect (Resolves #217)#258
Merged
indresh404 merged 1 commit intoJun 3, 2026
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
What does this PR do?
This PR resolves an issue where a user who had already fully onboarded could manually navigate to the
/onboardingroute 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:
OnboardingRouteinsrc/routes/AppRoutes.jsxto explicitly check ifuserData.onboardingStatus === "complete". If a user is already fully onboarded, the guard now instantly catches this and redirects them to the/dashboard.useEffectinsidesrc/App.jsxthat detects when a user manually types a path likelocalhost:5173/onboarding(without the hash) and forces a hardwindow.location.replaceto 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:
/onboardingstrictly redirects fully onboarded users to/dashboard./onboardingmanually correctly evaluates the route using the HashRouter instead of ignoring it.Visual Proof:
RankerHub-.-Gamified-Developer-Leaderboard.1.mp4
Closes: #217