Fix afterSignUpUrl base path in SignUpBox to include BASE_URL prefix#3063
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughSignUpBox now computes a sign-in path and an absolute afterSignUpUrl using window.location.origin plus a normalized import.meta.env.BASE_URL, passes that URL to the SignUp component, and navigates in-app via the sign-in path; tests capture and assert the computed afterSignUpUrl. ChangesSignUpBox URL Standardization
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
frontend/apps/gate/src/components/SignUp/SignUpBox.tsxESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox. frontend/apps/gate/src/components/SignUp/__tests__/SignUpBox.test.tsxESLint skipped: the ESLint configuration for this file references a package that is not available in the sandbox. 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.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@frontend/apps/gate/src/components/SignUp/SignUpBox.tsx`:
- Around line 40-44: The afterSignUpUrl is currently root-relative and causes
new URL(afterSignUpUrl) to throw in the SDK; update SignUpBox.tsx to produce an
absolute URL before passing it to the SDK by resolving ROUTES.AUTH.SIGN_IN
against the app origin+base (use import.meta.env.BASE_URL +
window.location.origin or resolve signInPath against window.location.origin and
the BASE_URL) so afterSignUpUrl is a full URL string (include reference to the
afterSignUpUrl variable, ROUTES.AUTH.SIGN_IN, and import.meta.env.BASE_URL to
locate and change the construction).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 59910cfe-e980-4710-9b57-d602644bb072
📒 Files selected for processing (2)
frontend/apps/gate/src/components/SignUp/SignUpBox.tsxfrontend/apps/gate/src/components/SignUp/__tests__/SignUpBox.test.tsx
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Head branch was pushed to by a user without write access
a731cf0 to
e3cb8f9
Compare
|
Actionable comments posted: 0 |
Purpose
The sign-up flow was redirecting users to
<origin>/signininstead of<origin>/gate/signinafter successful registration. The
afterSignUpUrlprop passed to the<SignUp>component wasset to
ROUTES.AUTH.SIGN_IN(/signin) — a React Router-relative path. Whenwindow.location.hrefis assigned that value inside the SDK, it resolves against the origin directly, bypassing React
Router's
basenameconfiguration entirely.Approach
SignUpBoxuses two different navigation mechanisms with different semantics:navigate(path)— goes through React Router, which automatically prepends the configuredbasename(/gate/). The raw route constant (/signin) is correct here.window.location.href = url(used internally by the SDK viaafterSignUpUrl) — resolvesagainst the origin with no knowledge of React Router's
basename. The full path includingthe base must be provided explicitly.
The fix separates the single
signInUrlvariable into two:signInPath— the raw Router path (/signin), used fornavigate()afterSignUpUrl— the full origin-relative URL constructed asBASE_URL + signInPath(stripping Vite's trailing slash from
BASE_URL), passed as theafterSignUpUrlpropThis follows the existing
generateFallbackSignUpUrlpattern already established in thegate app for the same reason.
Summary by CodeRabbit
Refactor
Tests