Skip to content

fix: skip pathless routes with loaders during SSR#73

Merged
uhyo merged 1 commit intomasterfrom
fix/skip-pathless-routes-with-loader-during-ssr
Feb 7, 2026
Merged

fix: skip pathless routes with loaders during SSR#73
uhyo merged 1 commit intomasterfrom
fix/skip-pathless-routes-with-loader-during-ssr

Conversation

@uhyo
Copy link
Owner

@uhyo uhyo commented Feb 7, 2026

Summary

  • Pathless routes with loaders were rendering during SSR with data: undefined, violating the component's type contract (data: TData). Now matchRoutes treats them as non-matching when pathname is null (SSR), so they only render after hydration when loaders can actually execute.
  • Sibling pathless routes without loaders still match normally, enabling fallback SSR shells.
  • Updated SSR documentation to reflect the new behavior.

Test plan

  • Added 4 new unit tests in matchRoutes.test.ts covering:
    • Pathless route with loader does NOT match when pathname is null
    • Sibling without loader matches when pathless route with loader is skipped
    • Nested pathless route with loader stops SSR matching at that level
    • Pathless route with loader still matches on the client (non-null pathname)
  • All 174 existing + new tests pass
  • Full typecheck passes across all packages

🤖 Generated with Claude Code

Pathless routes with loaders were rendering during SSR with
data: undefined, violating the component's type contract.
Now matchRoutes treats them as non-matching when pathname is null,
so they only render after hydration when loaders can actually run.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@uhyo uhyo merged commit 6a7f407 into master Feb 7, 2026
1 check passed
@uhyo uhyo deleted the fix/skip-pathless-routes-with-loader-during-ssr branch February 7, 2026 02:23
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.

1 participant