-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Convert notFound() to redirect()
#2756
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 GitHub.
|
WalkthroughReplaces many notFound() calls with redirect(...) across multiple routes and components, adds slug to one page's params and signature, renames a couple of components, tweaks useParams destructuring/typing, and removes a stray comment. No other rendering or API changes. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Page
participant Data
participant NextNav as next/navigation
User->>Page: Request route
Page->>Data: Fetch entity/resource
Data-->>Page: Resource present or missing
alt missing
Page->>NextNav: redirect("/fallback-or-list")
else present
Page-->>User: Render content
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (2)
🧰 Additional context used🧠 Learnings (3)📓 Common learnings📚 Learning: 2025-08-18T02:31:22.226ZApplied to files:
📚 Learning: 2025-08-18T02:31:22.226ZApplied to files:
🧬 Code Graph Analysis (1)apps/web/app/app.dub.co/(dashboard)/[slug]/links/folders/[folderId]/members/page.tsx (3)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (6)
✨ Finishing Touches
🧪 Generate unit tests
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. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
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: 17
🧹 Nitpick comments (1)
apps/web/app/app.dub.co/(dashboard)/[slug]/links/[...link]/page-client.tsx (1)
42-42: Optional: tighten route param typing for[...link]If this route is always a catch-all segment, consider narrowing
linktostring[]in theuseParamsgeneric to match the route contract and avoid string cases.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (16)
apps/web/app/(ee)/app.dub.co/(new-program)/[slug]/program/new/connect/[[...guide]]/page.tsx(2 hunks)apps/web/app/(ee)/app.dub.co/(new-program)/sidebar-context.tsx(2 hunks)apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/customers/[customerId]/page-client.tsx(2 hunks)apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/apply/page.tsx(2 hunks)apps/web/app/[domain]/stats/[key]/page.tsx(2 hunks)apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/customers/[customerId]/page-client.tsx(2 hunks)apps/web/app/app.dub.co/(dashboard)/[slug]/links/[...link]/page-client.tsx(1 hunks)apps/web/app/app.dub.co/(dashboard)/[slug]/links/folders/[folderId]/members/page-client.tsx(2 hunks)apps/web/app/app.dub.co/(dashboard)/[slug]/settings/(basic-layout)/integrations/[integrationSlug]/manage/page.tsx(2 hunks)apps/web/app/app.dub.co/(dashboard)/[slug]/settings/(basic-layout)/integrations/[integrationSlug]/page.tsx(2 hunks)apps/web/app/app.dub.co/(dashboard)/[slug]/settings/(basic-layout)/integrations/new/page.tsx(2 hunks)apps/web/app/app.dub.co/(dashboard)/[slug]/settings/(basic-layout)/oauth-apps/[appId]/page-client.tsx(2 hunks)apps/web/app/app.dub.co/(dashboard)/[slug]/settings/webhooks/[webhookId]/edit/page-client.tsx(1 hunks)apps/web/app/app.dub.co/(share)/share/[dashboardId]/page.tsx(1 hunks)apps/web/app/deeplink/[domain]/[key]/page.tsx(0 hunks)apps/web/ui/webhooks/webhook-header.tsx(2 hunks)
💤 Files with no reviewable changes (1)
- apps/web/app/deeplink/[domain]/[key]/page.tsx
🧰 Additional context used
🧬 Code Graph Analysis (1)
apps/web/app/(ee)/app.dub.co/(new-program)/[slug]/program/new/connect/[[...guide]]/page.tsx (1)
apps/web/lib/get-integration-guide-markdown.ts (1)
getIntegrationGuideMarkdown(6-29)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build
🔇 Additional comments (13)
apps/web/app/[domain]/stats/[key]/page.tsx (1)
24-26: Swap to redirect("/") on missing dashboard looks goodServer-side redirect is appropriate here and matches the PR goal. The follow-up redirect to the share URL remains intact and safe since
link?.dashboardis checked beforehand.apps/web/app/app.dub.co/(dashboard)/[slug]/settings/(basic-layout)/integrations/[integrationSlug]/manage/page.tsx (2)
16-18: notFound → redirect is correct and target path is consistentBoth non-Dub workspace and missing integration now redirect to
/${params.slug}/settings/integrations. This aligns with the PR objective and keeps UX consistent.
24-26: Redirect on missing integration is appropriateUsing a redirect instead of a 404 matches the new handling. No additional guards needed since
redirect()aborts rendering.apps/web/app/app.dub.co/(dashboard)/[slug]/settings/(basic-layout)/integrations/[integrationSlug]/page.tsx (2)
2-2: Importing redirect is correct for server-side navigationThis page is server-rendered; using
redirectfromnext/navigationis the right API.
47-49: Unified redirect for missing/comingSoon is clean and safeCollapsing the conditions to a single redirect simplifies the control flow. Since
redirect()throws, subsequent code won't run in those cases.apps/web/app/app.dub.co/(dashboard)/[slug]/settings/webhooks/[webhookId]/edit/page-client.tsx (1)
16-16: LGTM: capturing slug for redirect target
IncludingslugfromuseWorkspace()enables constructing the proper settings path. No issues here.apps/web/app/app.dub.co/(share)/share/[dashboardId]/page.tsx (1)
33-37: Rename to PascalCase is fine; no functional impactChanging the default export from
dashboardPagetoDashboardPageis stylistic and does not affect behavior.apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/apply/page.tsx (2)
8-8: LGTM: switching to next/navigation.redirect on the server
Importingredirectin a Server Component is appropriate.
23-24: LGTM: server-side redirect on missing program
Redirecting to “/programs” whengetProgramreturns null is correct and non-breaking.apps/web/app/app.dub.co/(dashboard)/[slug]/settings/(basic-layout)/integrations/new/page.tsx (1)
4-4: Server-side redirect here is correct and aligns with App Router semanticsSwitching from notFound to redirect in this server component is appropriate. The early redirect for non-"dub" workspaces prevents unnecessary rendering, and the target path is consistent with the rest of the module.
Also applies to: 14-15
apps/web/app/(ee)/app.dub.co/(new-program)/[slug]/program/new/connect/[[...guide]]/page.tsx (3)
5-5: Server-side redirect is appropriateUsing
redirecthere is correct (server component). This keeps the flow consistent and avoids rendering a 404.
9-15: Param signature update looks goodIncluding
sluginparamsaligns with the route path and enables correct, scoped redirects.
24-31: Defensive redirects on missing guide/content are soundRedirecting back to the connect index when the guide is invalid or content is missing is a sensible UX choice. The upstream
getIntegrationGuideMarkdownalready sanitizes inputs.
Summary by CodeRabbit
New Features
Bug Fixes
Chores