Skip to content

Fix afterSignUpUrl base path in SignUpBox to include BASE_URL prefix#3063

Merged
ThaminduDilshan merged 1 commit into
thunder-id:mainfrom
Dilusha-Madushan:fix/signup-redirect-path-and-complete-node-view
May 28, 2026
Merged

Fix afterSignUpUrl base path in SignUpBox to include BASE_URL prefix#3063
ThaminduDilshan merged 1 commit into
thunder-id:mainfrom
Dilusha-Madushan:fix/signup-redirect-path-and-complete-node-view

Conversation

@Dilusha-Madushan

@Dilusha-Madushan Dilusha-Madushan commented May 28, 2026

Copy link
Copy Markdown
Contributor

Purpose

The sign-up flow was redirecting users to <origin>/signin instead of <origin>/gate/signin
after successful registration. The afterSignUpUrl prop passed to the <SignUp> component was
set to ROUTES.AUTH.SIGN_IN (/signin) — a React Router-relative path. When window.location.href
is assigned that value inside the SDK, it resolves against the origin directly, bypassing React
Router's basename configuration entirely.

Approach

SignUpBox uses two different navigation mechanisms with different semantics:

  • navigate(path) — goes through React Router, which automatically prepends the configured
    basename (/gate/). The raw route constant (/signin) is correct here.
  • window.location.href = url (used internally by the SDK via afterSignUpUrl) — resolves
    against the origin with no knowledge of React Router's basename. The full path including
    the base must be provided explicitly.

The fix separates the single signInUrl variable into two:

  • signInPath — the raw Router path (/signin), used for navigate()
  • afterSignUpUrl — the full origin-relative URL constructed as BASE_URL + signInPath
    (stripping Vite's trailing slash from BASE_URL), passed as the afterSignUpUrl prop

This follows the existing generateFallbackSignUpUrl pattern already established in the
gate app for the same reason.

Summary by CodeRabbit

  • Refactor

    • Standardized signup navigation and post-signup redirect URL to derive from app routes and the current site origin, ensuring consistent in-app navigation and redirects.
  • Tests

    • Added test coverage to verify the post-signup redirect is an absolute URL with the base path normalized and the expected sign-in path appended.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: f4cd73e1-f1e6-41c0-b6e7-9dd1a9a976ee

📥 Commits

Reviewing files that changed from the base of the PR and between a731cf0 and e3cb8f9.

📒 Files selected for processing (2)
  • frontend/apps/gate/src/components/SignUp/SignUpBox.tsx
  • frontend/apps/gate/src/components/SignUp/__tests__/SignUpBox.test.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • frontend/apps/gate/src/components/SignUp/tests/SignUpBox.test.tsx
  • frontend/apps/gate/src/components/SignUp/SignUpBox.tsx

📝 Walkthrough

Walkthrough

SignUpBox 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.

Changes

SignUpBox URL Standardization

Layer / File(s) Summary
SignUpBox URL handling and navigation logic
frontend/apps/gate/src/components/SignUp/SignUpBox.tsx
signInPath constant and afterSignUpUrl are computed using window.location.origin and import.meta.env.BASE_URL (trailing slash removed). The SignUp component receives afterSignUpUrl, and the "Sign in" button calls navigate(signInPath).
SignUpBox test suite for URL verification
frontend/apps/gate/src/components/SignUp/__tests__/SignUpBox.test.tsx
Mocks capture afterSignUpUrl passed to the ThunderID SignUp component, resets the capture in beforeEach, and adds a test asserting the absolute URL equals window.location.origin + normalized import.meta.env.BASE_URL + /signin.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • brionmario
  • jeradrutnam
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main fix: adding BASE_URL prefix to the afterSignUpUrl in SignUpBox component.
Description check ✅ Passed The description provides detailed purpose and approach sections explaining the bug and solution, but lacks some checklist items and test documentation references required by the template.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

frontend/apps/gate/src/components/SignUp/SignUpBox.tsx

ESLint 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.tsx

ESLint 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.

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 090d450 and a731cf0.

📒 Files selected for processing (2)
  • frontend/apps/gate/src/components/SignUp/SignUpBox.tsx
  • frontend/apps/gate/src/components/SignUp/__tests__/SignUpBox.test.tsx

Comment thread frontend/apps/gate/src/components/SignUp/SignUpBox.tsx Outdated
@codecov

codecov Bot commented May 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

auto-merge was automatically disabled May 28, 2026 17:22

Head branch was pushed to by a user without write access

@Dilusha-Madushan Dilusha-Madushan force-pushed the fix/signup-redirect-path-and-complete-node-view branch from a731cf0 to e3cb8f9 Compare May 28, 2026 17:22
@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown
Contributor

Actionable comments posted: 0

@ThaminduDilshan ThaminduDilshan added this pull request to the merge queue May 28, 2026
Merged via the queue into thunder-id:main with commit 3300834 May 28, 2026
29 of 46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants