-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Danny/fixing docs apps redirect #16478
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 ↗︎ 3 Skipped Deployments
|
|
Warning Rate limit exceeded@dannyroosevelt has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 0 minutes and 46 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (4)
WalkthroughThis update removes a permanent redirect rule from the Next.js configuration that previously redirected all Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Next.js App
participant Middleware
participant Custom404 Component
User->>Next.js App: Requests non-existent page
Next.js App->>Middleware: Checks request path
alt Path is unmatched and not static/API
Middleware->>User: 301 Redirect to "/"
else Path allowed or static
Next.js App->>Custom404 Component: Renders 404 page (fallback)
Custom404 Component->>User: Displays "Page not found" message
Custom404 Component->>Next.js App: Triggers router.replace('/')
Next.js App->>User: Redirects to home page
end
Possibly related PRs
Poem
✨ 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:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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 (2)
docs-v2/pages/404.tsx (2)
4-10: Consider adding a delay before redirectionThe current implementation immediately redirects users to the home page, which might not give them enough time to read the error message. Consider adding a short delay (2-3 seconds) to allow users to see and understand the 404 message before being redirected.
useEffect(() => { // 302 redirect (temporary) to home page - router.replace('/') + setTimeout(() => { + router.replace('/') + }, 3000) // 3 second delay before redirect }, [router])
12-19: Improve accessibility and semantics of the 404 pageWhile the layout works well, consider these improvements:
- Use semantic HTML for error pages
- Add appropriate ARIA roles and attributes
- Consider using a styled component or CSS module instead of inline styles for consistency with the rest of the application
return ( - <div style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', height: '100vh' }}> - <div> - <h1>Page not found</h1> - <p>Redirecting to home page...</p> - </div> - </div> + <main + style={{ display: 'flex', justifyContent: 'center', alignItems: 'center', height: '100vh' }} + role="alert" + aria-labelledby="error-title" + > + <div className="error-container"> + <h1 id="error-title">Page not found</h1> + <p>Redirecting to home page...</p> + </div> + </main> )
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
docs-v2/next.config.mjs(0 hunks)docs-v2/pages/404.tsx(1 hunks)
💤 Files with no reviewable changes (1)
- docs-v2/next.config.mjs
🔇 Additional comments (2)
docs-v2/pages/404.tsx (2)
1-2: Imports look good!The imports correctly include the necessary React and Next.js hooks for implementing a redirect-based 404 page.
4-20: Consider SEO implications of auto-redirecting 404 pagesAutomatically redirecting from a 404 page to the home page can affect how search engines index your site. Search engines prefer that non-existent URLs return proper 404 status codes without redirects.
For documentation sites, consider:
- Maintaining the 404 status without redirecting
- Adding helpful navigation options instead of automatic redirection
- If redirection is required, ensure the server still returns a 404 status code first
Before implementing this change, confirm if automatic redirection is the desired behavior for all 404 cases, especially for SEO considerations.
…mHQ/pipedream into danny/fixing-docs-apps-redirect
…mHQ/pipedream into danny/fixing-docs-apps-redirect
…mHQ/pipedream into danny/fixing-docs-apps-redirect
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: 2
🧹 Nitpick comments (4)
docs-v2/middleware.ts (2)
13-13: Remove trailing whitespace.There's a trailing space at the end of this line.
- const pathname = request.nextUrl.pathname + const pathname = request.nextUrl.pathname🧰 Tools
🪛 GitHub Check: Lint Code Base
[failure] 13-13:
Trailing spaces not allowed
16-16: Remove trailing whitespace.There's a trailing space at the end of this line.
- pathname.startsWith('/_next') || + pathname.startsWith('/_next') ||🧰 Tools
🪛 GitHub Check: Lint Code Base
[failure] 16-16:
Strings must use doublequote
[failure] 16-16:
Trailing spaces not alloweddocs-v2/pages/404.tsx (2)
12-20: Consider adding user feedback while redirect is pending.The current implementation has a 100ms delay before redirecting, which is very short but could be noticeable to users on slower connections.
You could consider adding a visual indicator (like a spinner) or using a fade-out animation during the redirect process to enhance user experience.
useEffect(() => { // Set a state to show loading/redirect in progress setIsRedirecting(true); const redirectTimeout = setTimeout(() => { router.replace("/") }, 100) return () => clearTimeout(redirectTimeout) }, [router])
23-34: Consider adding more semantic HTML structure.The current implementation uses generic div elements with inline styles. For better accessibility and semantics, consider using more appropriate HTML elements.
return ( <div style={{ display: "flex", justifyContent: "center", alignItems: "center", height: "100vh", }}> - <div> + <main> <h1>Page not found</h1> <p>Redirecting to home page...</p> - </div> + </main> </div> )
📜 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 (13)
.gitignore(1 hunks)docs-v2/middleware.ts(1 hunks)docs-v2/next.config.mjs(1 hunks)docs-v2/pages/404.tsx(1 hunks)docs-v2/pages/connect/api.mdx(9 hunks)docs-v2/pages/connect/components.mdx(1 hunks)docs-v2/pages/connect/environments.mdx(1 hunks)docs-v2/pages/connect/managed-auth/connect-link.mdx(1 hunks)docs-v2/pages/connect/managed-auth/quickstart.mdx(2 hunks)docs-v2/pages/connect/managed-auth/tokens.mdx(2 hunks)docs-v2/pages/connect/managed-auth/users.mdx(1 hunks)docs-v2/pages/connect/managed-auth/webhooks.mdx(1 hunks)docs-v2/pages/privacy-and-security/index.mdx(1 hunks)
✅ Files skipped from review due to trivial changes (10)
- docs-v2/pages/connect/environments.mdx
- docs-v2/pages/connect/managed-auth/users.mdx
- .gitignore
- docs-v2/pages/connect/managed-auth/connect-link.mdx
- docs-v2/pages/connect/managed-auth/webhooks.mdx
- docs-v2/pages/privacy-and-security/index.mdx
- docs-v2/pages/connect/managed-auth/quickstart.mdx
- docs-v2/pages/connect/managed-auth/tokens.mdx
- docs-v2/pages/connect/components.mdx
- docs-v2/pages/connect/api.mdx
🚧 Files skipped from review as they are similar to previous changes (1)
- docs-v2/next.config.mjs
🧰 Additional context used
🪛 GitHub Check: Lint Code Base
docs-v2/middleware.ts
[failure] 1-1:
Strings must use doublequote
[failure] 2-2:
Strings must use doublequote
[failure] 13-13:
Trailing spaces not allowed
[failure] 16-16:
Strings must use doublequote
[failure] 16-16:
Trailing spaces not allowed
[failure] 17-17:
Strings must use doublequote
[failure] 18-18:
Strings must use doublequote
[failure] 19-19:
Strings must use doublequote
[failure] 25-25:
Strings must use doublequote
[failure] 39-39:
Strings must use doublequote
🪛 GitHub Actions: Pull Request Checks
docs-v2/middleware.ts
[error] 1-1: ESLint: Strings must use doublequote (quotes) at line 1, column 30.
🔇 Additional comments (1)
docs-v2/pages/404.tsx (1)
1-35: Clean implementation of fallback 404 redirect page.The Custom404 component implements a good fallback mechanism for the middleware with proper cleanup of the timeout. The code is well-structured with clear documentation and follows good React practices.
…mHQ/pipedream into danny/fixing-docs-apps-redirect
WHY
Summary by CodeRabbit
New Features
Chores