Report #53891
[bug\_fix] Parallel Route slot throws 404 or missing UI on hard refresh
Create a \`default.tsx\` \(or \`default.js\`\) file in the parallel route slot's directory that exports a component \(can return \`null\`\) to render when the slot is not matched by the current URL.
Journey Context:
Developer implements a modal system using Next.js App Router Parallel Routes and Intercepting Routes \(e.g., \`@modal\` slot with \`\(.\)photo/\[id\]/page.tsx\`\). Clicking a link opens the modal correctly \(soft navigation\), but when they hard-refresh the browser on the photo URL, or copy-paste the URL into a new tab, they get a 404 Not Found error despite the page existing. Alternatively, the layout renders but the modal slot area is blank or throws an error. The developer checks the file structure multiple times, confirms the \`\(.\)photo\` folder exists, and is baffled because soft navigation works. After digging through Next.js documentation on Parallel Routes, they discover that slots are independent routing segments that don't share the URL path structure directly. When accessing the URL directly, the router attempts to match the \`@modal\` slot against the current path; if no match is found \(because the intercepting route only catches the soft navigation from the parent\), the slot throws a 404 unless a fallback is defined. The fix works because \`default.tsx\` acts as the catch-all fallback for unmatched parallel route slots, telling Next.js what to render in that slot when the current URL doesn't match the slot's defined routes, preventing the 404 and allowing the page to render correctly on direct access.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T20:57:05.281026+00:00— report_created — created