-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Trying to fix endless redirect loop #16363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThe redirection logic for the Changes
Poem
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
docs-v2/next.config.mjsOops! Something went wrong! :( ESLint: 8.57.1 Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'jsonc-eslint-parser' imported from /eslint.config.mjs Tip ⚡💬 Agentic Chat (Pro Plan, General Availability)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
docs-v2/next.config.mjs (1)
325-337: Document the redirection strategyConsider adding inline documentation explaining why these specific redirects are necessary and how they differ from the previous approach. This would help future maintainers understand the purpose of these changes and prevent accidental reintroduction of the redirect loop.
{ source: "/components/", destination: "/components/contributing/", permanent: true, + // Direct path to prevent redirect loops with workflows/contributing paths }, { source: "/components/api/", destination: "/components/contributing/api/", permanent: true, + // Specific API path redirect that replaces the previous catch-all pattern }, { source: "/components/quickstart/:path*/", destination: "/components/contributing/:path*/", permanent: true, + // Targeted quickstart path redirect that preserves subpaths },
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (1)
docs-v2/next.config.mjs(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: pnpm publish
- GitHub Check: Lint Code Base
🔇 Additional comments (4)
docs-v2/next.config.mjs (4)
325-328: Redirection path simplified to avoid potential loopsThe redirection for
/components/has been updated to point directly to/components/contributing/instead of what was likely/workflows/contributing/components/before. This helps avoid potential redirection chains that could lead to loops.
330-333: Added specific API path redirectGood addition of a specific redirect for
/components/api/which routes to/components/contributing/api/. Using targeted redirects instead of catch-all patterns helps prevent unintended redirection behaviors.
335-337: Added specific quickstart path redirectThe implementation of a targeted redirect for
/components/quickstart/:path*/helps maintain specific paths while preventing redirection loops. This approach is more maintainable than catch-all redirects.
325-337:✅ Verification successful
Verify this resolves the redirect loop
The changes appear to address a redirection loop by replacing a catch-all redirect with specific routes. The changes work in conjunction with existing redirects at lines 475-488 that redirect
/workflows/contributing/components/to/components/contributing/.Also applies to: 475-488
🏁 Script executed:
#!/bin/bash # Check for any remaining potential redirect loops involving components paths echo "Checking for potential circular redirects involving components paths..." # Look for any redirects that might point back to components echo "Redirects that might point back to the components path:" rg -A 3 -B 1 "destination.*(/components/|/workflows/contributing/components/)" --glob "*.mjs" | grep -v "source.*(/components/|/workflows/contributing/components/)" # Check if there are any other redirects using the components path as source echo "All redirects with components in the source path:" rg -A 3 -B 1 "source.*(/components/)" --glob "*.mjs"Length of output: 4090
Confirmed: no redirect loops in component routes
I verified all component-related redirects in
docs-v2/next.config.mjsand found no circular paths. The new specific redirects for
/components/→/components/contributing//components/api/→/components/contributing/api//components/quickstart/:path*/→/components/contributing/:path*/work alongside the existing
/workflows/contributing/components/...redirects (lines 475–488) to land cleanly on/components/contributing/...without looping.
WHY
Summary by CodeRabbit
/components/section, providing more specific and organized redirects for improved navigation.