Skip to content

fix(react-router): preserve caseSensitive in createClientRoutes() and createRoutesStub() - #15808

Merged
brophdawg11 merged 2 commits into
remix-run:mainfrom
adityajai119:fix/client-routes-case-sensitive
Nov 23, 2026
Merged

brophdawg11 merged 2 commits into
remix-run:mainfrom
adityajai119:fix/client-routes-case-sensitive

Conversation

@adityajai119

Copy link
Copy Markdown
Contributor

Fixes #15807

In Framework Mode, @react-router/dev emits caseSensitive: route.caseSensitive into both the server build and the browser assetsManifest, and both createStaticHandlerDataRoutes() (packages/react-router/lib/server-runtime/routes.ts) and createServerRoutes() (packages/react-router/lib/dom/ssr/routes.tsx) forward caseSensitive: route.caseSensitive onto the created DataRouteObject.

However, createClientRoutes() in packages/react-router/lib/dom/ssr/routes.tsx omitted caseSensitive:

let dataRoute: DataRouteObject = {
  id: route.id,
  index: route.index,
  path: route.path,
};

Because <HydratedRouter>, getHydrationData(), lazy route discovery (fog-of-war.ts and route-discovery.ts), and HMR (createClientRoutesWithHMRRevalidationOptOut()) all construct client routes through createClientRoutes(), every caseSensitive: true route became case-insensitive on the client, diverging from SSR and server data matching.

Similarly, processRoutes() in createRoutesStub() (packages/react-router/lib/dom/ssr/routes-test-stub.tsx) omitted caseSensitive: route.caseSensitive when constructing both newRoute and entryRoute, even though StubRouteObject accepts caseSensitive?: boolean.

This forwards caseSensitive: route.caseSensitive in createClientRoutes() (matching createServerRoutes()) and in createRoutesStub()'s processRoutes().

Tests:

  • packages/react-router/__tests__/dom/ssr/routes-test.tsx: covers createClientRoutes() on critical and lazy routes compared against createServerRoutes(), getHydrationData(), createClientRoutesWithHMRRevalidationOptOut(), fetchAndApplyManifestPatches(), and RouteDiscoveryRuntime.
  • packages/react-router/__tests__/dom/stub-test.tsx: covers createRoutesStub() with caseSensitive: true routes and a catch-all fallback.

All 6 new tests fail on main:

Tests: 6 failed, 15 passed, 21 total

and pass with this change (21 passed, 21 total). Also run locally on Windows 11 with Node 24.22.1:

  • pnpm test packages/react-router/ (--maxWorkers=2, with the 14 suites that hit 5000ms timeouts under parallel load re-run cleanly via --runInBand --testTimeout=30000): all 126 suites passed (3056 passed, 15 skipped)
  • pnpm --filter react-router exec tsc --noEmit: clean
  • pnpm exec eslint and pnpm exec prettier --check on changed files: clean
  • pnpm run changes:validate: valid
  • pnpm run --filter react-router build and the standalone reproduction script from createClientRoutes() and createRoutesStub() drop caseSensitive on routes #15807 against dist/production/index.js: createClientRoutes(), getHydrationData(), and createRoutesStub() all respect caseSensitive: true

AI-assisted: drafted with an AI coding agent; the tests above were run locally.

@brophdawg11 brophdawg11 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified that the Framework client routes and createRoutesStub() preserve caseSensitive. The six regressions failed before the fix and passed afterward, and the unit and Chromium suites passed on the tested merge tree.

Authored by an AI agent on behalf of @brophdawg11

@brophdawg11
brophdawg11 merged commit 7e7c88b into remix-run:main Nov 23, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

createClientRoutes() and createRoutesStub() drop caseSensitive on routes

2 participants