Explicit Route isn't Intercepted #81241
-
SummaryMy problemI am having issues with one particular route from being intercepted. To Reproduce
Additional information
Examplehttps://codesandbox.io/p/devbox/routing-issue-forked-yf9jdy?workspaceId=ws_99Vv8JQkByXmvk6vyjbsnP |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi! 👋 Thanks for the clear explanation and sandbox — I was able to reproduce the issue and it's a common pitfall with Next.js App Router’s routing priorities. 🔍 Problem SummaryYou're expecting the static route:
to be matched directly, but instead it’s falling into your dynamic catch-all route:
So when you click "Create", you’re seeing the fallback content instead of the expected static page. This happens because Next.js treats 🧠 Why This HappensIn the Next.js App Router, routing follows these rules:
So since there’s no static ✅ How to Fix ItYou simply need to explicitly define a static route for 📁 File Structure Fix:app
└── form
├── create
│ └── page.tsx ✅ Create this file
└── [draftVer]
└── row
└── page.tsx This way, 🧪 Optional: Clean URL ConflictsTo avoid conflicts with reserved dynamic values like
✅ TL;DR
Let me know if you'd like help editing your sandbox — happy to help you get it wired up! 🔧 |
Beta Was this translation helpful? Give feedback.
Hi! 👋 Thanks for the clear explanation and sandbox — I was able to reproduce the issue and it's a common pitfall with Next.js App Router’s routing priorities.
🔍 Problem Summary
You're expecting the static route:
to be matched directly, but instead it’s falling into your dynamic catch-all route:
So when you click "Create", you’re seeing the fallback content instead of the expected static page. This happens because Next.js treats
create
as a value for[draftVer]
since it's not declared as a static route.🧠 Why This Happens
In the Next.js App Router, routing follows these rules:
form/create
) have higher priority, but only if defined.