Skip to content

feat: fail the build for dynamic fs-routes without generateStaticParams#136

Merged
uhyo merged 1 commit into
masterfrom
claude/nextjs-routing-adapter-uvwk3m
Jul 11, 2026
Merged

feat: fail the build for dynamic fs-routes without generateStaticParams#136
uhyo merged 1 commit into
masterfrom
claude/nextjs-routing-adapter-uvwk3m

Conversation

@uhyo

@uhyo uhyo commented Jul 11, 2026

Copy link
Copy Markdown
Owner

Summary

A dynamic route (e.g. blog/[slug]/page.tsx) without a generateStaticParams() export now fails the build instead of being skipped with a warning.

Motivation

The previous warning claimed the route "still works on the client via the SPA fallback", but that claim was only half-true:

  • RSC payloads are serialized at build time with each entry's concrete params, so a server-component page reached via the SPA fallback renders with empty params — only "use client" pages reading useRouteParams() would get correct values.
  • The SPA fallback itself only exists in the dev/preview servers; on real static hosting it requires host-level rewrite configuration the framework doesn't provide.
  • Even where it "works", the visitor gets the index page's title/meta and a soft-200 instead of a 404 for invalid URLs.

Since a static site can only serve pages enumerated at build time, failing loudly is more honest than silently producing a route that mostly doesn't work.

Changes

  • collectStaticPaths() throws a descriptive error for a dynamic route without generateStaticParams(); its now-unused onWarn parameter is removed (fs-routes is @experimental and exempt from semver).
  • FsRouteModule.generateStaticParams JSDoc documents the export as required for dynamic routes.
  • Unit test updated from "warns and skips" to "throws".
  • Docs (FileSystemRouting.mdx) document the build failure and drop the SPA-fallback claim.

Note

Technically breaking for anyone relying on the old skip behavior, though fs-routes is documented as experimental and not subject to semver.

🤖 Generated with Claude Code

https://claude.ai/code/session_0183g2LXhE2PfPpg5KTmFLrM


Generated by Claude Code

Previously a dynamic route without generateStaticParams() was skipped
with a warning claiming it "still works on the client via the SPA
fallback". That claim was only half-true: RSC payloads are serialized
at build time with each entry's concrete params, so a server-component
page reached via the SPA fallback renders with empty params, and the
fallback itself requires host-level rewrite configuration.

Since a static site can only serve pages enumerated at build time, the
missing export is now a build error instead of a silent skip. The
unused onWarn parameter is removed from collectStaticPaths, and the
docs no longer advertise the SPA fallback for dynamic routes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0183g2LXhE2PfPpg5KTmFLrM
@uhyo uhyo merged commit 80751f7 into master Jul 11, 2026
2 checks passed
@uhyo uhyo deleted the claude/nextjs-routing-adapter-uvwk3m branch July 11, 2026 02:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants