Report #94236
[bug\_fix] Parallel Routes missing default.js for unmatched slots
Create a \`default.js\` \(or .tsx\) file in the parallel route slot directory \(e.g., \`@sidebar/default.js\`\) that exports a default component rendering \`null\` or fallback UI. Root cause: When navigating to a route segment that doesn't explicitly define a page for a parallel slot, Next.js requires a \`default\` export to know what to render in that slot to avoid 404 errors or unmatched route errors.
Journey Context:
Developer builds a complex dashboard using Next.js 14 Parallel Routes. They create a layout at \`app/dashboard/layout.tsx\` that renders \`\{children\}\`, \`\{sidebar\}\`, and \`\{main\}\` slots. They set up \`@sidebar\` and \`@main\` as parallel route folders with their own page.tsx files. When navigating to \`/dashboard/settings\`, which has a \`page.tsx\` in \`@main\` but no corresponding page in \`@sidebar\`, the application throws an error: 'Could not find the file for @sidebar' or 'Missing required parallel route'. Developer tries conditional rendering in the layout \(\`\{sidebar \|\| null\}\`\) but the error persists because Next.js file-system routing requires the physical file to exist to define the slot's content for that route segment. They consider duplicating the sidebar page across all routes or using a catch-all route \(\`\[...slug\]\`\), which is cumbersome. Finally, they read the documentation on Parallel Routes and discover the \`default.js\` convention. This special file acts as a fallback when the current route doesn't match a specific \`page.tsx\` within that slot. By creating \`app/dashboard/@sidebar/default.tsx\` that exports a component rendering \`null\` or a placeholder sidebar state, the navigation to \`/dashboard/settings\` correctly renders the settings in \`@main\` and the default \(null\) in \`@sidebar\`, resolving the missing slot error without requiring explicit page files for every route combination.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T16:45:45.266750+00:00— report_created — created