Skip to content

fix: pass pathname to global request middleware in createStartHandler - #6648

Merged
schiller-manuel merged 4 commits into
TanStack:mainfrom
kkznch:fix/pass-pathname-to-global-request-middleware
Feb 14, 2026
Merged

fix: pass pathname to global request middleware in createStartHandler#6648
schiller-manuel merged 4 commits into
TanStack:mainfrom
kkznch:fix/pass-pathname-to-global-request-middleware

Conversation

@kkznch

@kkznchkkznch commented Feb 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fix pathname being undefined in global request middleware registered via createStart({ requestMiddleware })
  • Add pathname: url.pathname to both executeMiddleware calls for global request middleware in createStartHandler
  • Route-level middleware in handleServerRoutes already passes pathname correctly; this aligns the global middleware calls

Details

The TypeScript type RequestServerOptions declares pathname: string, but at runtime the two executeMiddleware calls for global request middleware did not include pathname in the initial context object:

  1. Server function path (createStartHandler.ts L532-535): { request, context } — missing pathname
  2. Page request path (createStartHandler.ts L626-629): { request, context } — missing pathname

The url variable is already available in scope via getNormalizedURL(request.url), so the fix simply adds pathname: url.pathname to both call sites.

Test plan

  • Verify pathname is correctly passed as a string in middleware registered via createStart({ requestMiddleware })
  • Verify pathname is available during both server function calls and page requests
  • Verify no regression in route-level middleware behavior

Closes#6647

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Global request middleware now receives the request URL pathname in its request context, making the pathname available to downstream handlers.
    • Added a new page that displays the middleware-captured pathname and a navigation link to that page for verification.
  • Tests

    • Added end-to-end tests validating pathname propagation for server-side rendering and client-side navigation.

The two `executeMiddleware` calls for global request middleware in
`createStartHandler` were missing the `pathname` property, causing it
to be `undefined` at runtime despite `RequestServerOptions` declaring
it as `pathname: string`.
- Add `pathname: url.pathname` to server function middleware execution
- Add `pathname: url.pathname` to page request middleware execution
The route-level middleware in `handleServerRoutes` already passes
`pathname` correctly.
ClosesTanStack#6647
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitaiBot commented Feb 13, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Adds the request URL pathname into the context passed to global request middleware in two start handler locations, and introduces an e2e route, middleware, and tests that validate the pathname is available to middleware.

Changes

Cohort / File(s)Summary
Start handler context
packages/start-server-core/src/createStartHandler.ts
Add pathname: url.pathname to the context passed into two executeMiddleware calls (server function handler and page request handler), exposing the request pathname to global request middleware.
Global middleware & start config
e2e/react-start/server-functions-global-middleware/src/start.ts
Add pathnameMiddleware that reads pathname and injects requestMiddlewarePathname into request context; include it in the global requestMiddleware array.
Route + loader + UI
e2e/react-start/server-functions-global-middleware/src/routes/pathname-middleware.tsx, e2e/react-start/server-functions-global-middleware/src/routes/index.tsx
Add /pathname-middleware server-driven route with a server fn/loader exposing requestMiddlewarePathname and add a Home link to it.
Route tree generation
e2e/react-start/server-functions-global-middleware/src/routeTree.gen.ts
Register PathnameMiddlewareRoute in generated route tree, augment types, and include it in route collections.
Tests
e2e/react-start/server-functions-global-middleware/tests/global-middleware.spec.ts
Add SSR and client navigation tests asserting the middleware-reported pathname is set (covers issue #6647).
Package manifest
package.json
Small manifest edits (minor line changes).

Sequence Diagram(s)

sequenceDiagram
participant Client as Client
participant Start as StartHandler
participant PathMW as pathnameMiddleware
participant LogMW as loggingMiddleware
participant Route as RouteLoader/ServerFn
participant Response as Response
Client->>Start: HTTP request
Start->>Start: getNormalizedURL -> url (includes url.pathname)
Start->>PathMW: executeMiddleware(context { request, context, pathname: url.pathname })
PathMW->>Start: next(context + { requestMiddlewarePathname })
Start->>LogMW: executeMiddleware(context with pathname)
LogMW->>Start: next()
Start->>Route: invoke loader/server function (context includes requestMiddlewarePathname)
Route-->>Start: loader data / server response
Start-->>Client: HTTP response
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • schiller-manuel
  • nlynzaad

Poem

🐰 I hopped through code at break of day,
Found a pathname that lost its way,
I tucked it into middleware's pouch,
Now routes can read it — what a couch!
Hooray — no more undefined fray! 🥕✨

🚥 Pre-merge checks | ✅ 4 | ❌ 2
❌ Failed checks (2 warnings)
Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 33.33% which is insufficient. The required threshold is 80.00%.Write docstrings for the functions missing them to satisfy the coverage threshold.
Merge Conflict Detection⚠️ Warning❌ Merge conflicts detected (188 files):

⚔️ docs/start/framework/react/getting-started.md (content)
⚔️ e2e/react-router/basic-file-based-code-splitting/src/routeTree.gen.ts (content)
⚔️ e2e/react-router/basic-file-based-code-splitting/src/routes/__root.tsx (content)
⚔️ e2e/react-start/server-functions-global-middleware/src/routeTree.gen.ts (content)
⚔️ e2e/react-start/server-functions-global-middleware/src/routes/index.tsx (content)
⚔️ e2e/react-start/server-functions-global-middleware/src/start.ts (content)
⚔️ e2e/react-start/server-functions-global-middleware/tests/global-middleware.spec.ts (content)
⚔️ examples/react/authenticated-routes-firebase/package.json (content)
⚔️ examples/react/authenticated-routes/package.json (content)
⚔️ examples/react/basic-default-search-params/package.json (content)
⚔️ examples/react/basic-devtools-panel/package.json (content)
⚔️ examples/react/basic-file-based/package.json (content)
⚔️ examples/react/basic-non-nested-devtools/package.json (content)
⚔️ examples/react/basic-react-query-file-based/package.json (content)
⚔️ examples/react/basic-react-query/package.json (content)
⚔️ examples/react/basic-ssr-file-based/package.json (content)
⚔️ examples/react/basic-ssr-streaming-file-based/package.json (content)
⚔️ examples/react/basic-virtual-file-based/package.json (content)
⚔️ examples/react/basic-virtual-inside-file-based/package.json (content)
⚔️ examples/react/basic/package.json (content)
⚔️ examples/react/deferred-data/package.json (content)
⚔️ examples/react/i18n-paraglide/package.json (content)
⚔️ examples/react/kitchen-sink-file-based/package.json (content)
⚔️ examples/react/kitchen-sink-react-query-file-based/package.json (content)
⚔️ examples/react/kitchen-sink-react-query/package.json (content)
⚔️ examples/react/kitchen-sink/package.json (content)
⚔️ examples/react/large-file-based/package.json (content)
⚔️ examples/react/location-masking/package.json (content)
⚔️ examples/react/navigation-blocking/package.json (content)
⚔️ examples/react/quickstart-esbuild-file-based/package.json (content)
⚔️ examples/react/quickstart-file-based/package.json (content)
⚔️ examples/react/quickstart-rspack-file-based/package.json (content)
⚔️ examples/react/quickstart-webpack-file-based/package.json (content)
⚔️ examples/react/quickstart/package.json (content)
⚔️ examples/react/router-monorepo-react-query/package.json (content)
⚔️ examples/react/router-monorepo-react-query/packages/app/package.json (content)
⚔️ examples/react/router-monorepo-react-query/packages/router/package.json (content)
⚔️ examples/react/router-monorepo-simple-lazy/package.json (content)
⚔️ examples/react/router-monorepo-simple-lazy/packages/app/package.json (content)
⚔️ examples/react/router-monorepo-simple-lazy/packages/router/package.json (content)
⚔️ examples/react/router-monorepo-simple/package.json (content)
⚔️ examples/react/router-monorepo-simple/packages/app/package.json (content)
⚔️ examples/react/router-monorepo-simple/packages/router/package.json (content)
⚔️ examples/react/scroll-restoration/package.json (content)
⚔️ examples/react/search-validator-adapters/package.json (content)
⚔️ examples/react/start-bare/package.json (content)
⚔️ examples/react/start-basic-auth/package.json (content)
⚔️ examples/react/start-basic-authjs/package.json (content)
⚔️ examples/react/start-basic-cloudflare/package.json (content)
⚔️ examples/react/start-basic-react-query/package.json (content)
⚔️ examples/react/start-basic-rsc/package.json (content)
⚔️ examples/react/start-basic-static/package.json (content)
⚔️ examples/react/start-basic/package.json (content)
⚔️ examples/react/start-bun/package.json (content)
⚔️ examples/react/start-clerk-basic/package.json (content)
⚔️ examples/react/start-convex-trellaux/package.json (content)
⚔️ examples/react/start-counter/package.json (content)
⚔️ examples/react/start-i18n-paraglide/package.json (content)
⚔️ examples/react/start-large/package.json (content)
⚔️ examples/react/start-material-ui/package.json (content)
⚔️ examples/react/start-streaming-data-from-server-functions/package.json (content)
⚔️ examples/react/start-supabase-basic/package.json (content)
⚔️ examples/react/start-tailwind-v4/package.json (content)
⚔️ examples/react/start-trellaux/package.json (content)
⚔️ examples/react/start-workos/package.json (content)
⚔️ examples/react/view-transitions/package.json (content)
⚔️ examples/react/with-framer-motion/package.json (content)
⚔️ examples/react/with-trpc-react-query/package.json (content)
⚔️ examples/react/with-trpc/package.json (content)
⚔️ examples/solid/authenticated-routes-firebase/package.json (content)
⚔️ examples/solid/authenticated-routes/package.json (content)
⚔️ examples/solid/basic-default-search-params/package.json (content)
⚔️ examples/solid/basic-devtools-panel/package.json (content)
⚔️ examples/solid/basic-file-based/package.json (content)
⚔️ examples/solid/basic-non-nested-devtools/package.json (content)
⚔️ examples/solid/basic-solid-query-file-based/package.json (content)
⚔️ examples/solid/basic-solid-query/package.json (content)
⚔️ examples/solid/basic-ssr-file-based/package.json (content)
⚔️ examples/solid/basic-ssr-streaming-file-based/package.json (content)
⚔️ examples/solid/basic-virtual-file-based/package.json (content)
⚔️ examples/solid/basic-virtual-inside-file-based/package.json (content)
⚔️ examples/solid/basic/package.json (content)
⚔️ examples/solid/deferred-data/package.json (content)
⚔️ examples/solid/i18n-paraglide/package.json (content)
⚔️ examples/solid/kitchen-sink-file-based/package.json (content)
⚔️ examples/solid/kitchen-sink-solid-query-file-based/package.json (content)
⚔️ examples/solid/kitchen-sink-solid-query/package.json (content)
⚔️ examples/solid/kitchen-sink/package.json (content)
⚔️ examples/solid/large-file-based/package.json (content)
⚔️ examples/solid/location-masking/package.json (content)
⚔️ examples/solid/navigation-blocking/package.json (content)
⚔️ examples/solid/quickstart-esbuild-file-based/package.json (content)
⚔️ examples/solid/quickstart-file-based/package.json (content)
⚔️ examples/solid/quickstart-rspack-file-based/package.json (content)
⚔️ examples/solid/quickstart-webpack-file-based/package.json (content)
⚔️ examples/solid/quickstart/package.json (content)
⚔️ examples/solid/router-monorepo-simple-lazy/package.json (content)
⚔️ examples/solid/router-monorepo-simple-lazy/packages/app/package.json (content)
⚔️ examples/solid/router-monorepo-simple-lazy/packages/router/package.json (content)
⚔️ examples/solid/router-monorepo-simple/package.json (content)
⚔️ examples/solid/router-monorepo-simple/packages/app/package.json (content)
⚔️ examples/solid/router-monorepo-simple/packages/router/package.json (content)
⚔️ examples/solid/router-monorepo-solid-query/package.json (content)
⚔️ examples/solid/router-monorepo-solid-query/packages/app/package.json (content)
⚔️ examples/solid/router-monorepo-solid-query/packages/router/package.json (content)
⚔️ examples/solid/scroll-restoration/package.json (content)
⚔️ examples/solid/search-validator-adapters/package.json (content)
⚔️ examples/solid/start-basic-auth/package.json (content)
⚔️ examples/solid/start-basic-authjs/package.json (content)
⚔️ examples/solid/start-basic-cloudflare/package.json (content)
⚔️ examples/solid/start-basic-netlify/package.json (content)
⚔️ examples/solid/start-basic-nitro/package.json (content)
⚔️ examples/solid/start-basic-solid-query/package.json (content)
⚔️ examples/solid/start-basic-static/package.json (content)
⚔️ examples/solid/start-basic/package.json (content)
⚔️ examples/solid/start-bun/package.json (content)
⚔️ examples/solid/start-convex-better-auth/package.json (content)
⚔️ examples/solid/start-counter/package.json (content)
⚔️ examples/solid/start-i18n-paraglide/package.json (content)
⚔️ examples/solid/start-large/package.json (content)
⚔️ examples/solid/start-streaming-data-from-server-functions/package.json (content)
⚔️ examples/solid/start-supabase-basic/package.json (content)
⚔️ examples/solid/start-tailwind-v4/package.json (content)
⚔️ examples/solid/view-transitions/package.json (content)
⚔️ examples/solid/with-framer-motion/package.json (content)
⚔️ examples/solid/with-trpc/package.json (content)
⚔️ examples/vue/basic-file-based-jsx/package.json (content)
⚔️ examples/vue/basic-file-based-sfc/package.json (content)
⚔️ examples/vue/basic/package.json (content)
⚔️ packages/arktype-adapter/package.json (content)
⚔️ packages/react-router-devtools/package.json (content)
⚔️ packages/react-router-ssr-query/package.json (content)
⚔️ packages/react-router/package.json (content)
⚔️ packages/react-router/src/Asset.tsx (content)
⚔️ packages/react-router/tests/Scripts.test.tsx (content)
⚔️ packages/react-router/tests/router.test.tsx (content)
⚔️ packages/react-start-client/package.json (content)
⚔️ packages/react-start-server/package.json (content)
⚔️ packages/react-start/package.json (content)
⚔️ packages/router-cli/package.json (content)
⚔️ packages/router-core/package.json (content)
⚔️ packages/router-core/src/load-matches.ts (content)
⚔️ packages/router-core/src/router.ts (content)
⚔️ packages/router-devtools-core/package.json (content)
⚔️ packages/router-devtools/package.json (content)
⚔️ packages/router-generator/package.json (content)
⚔️ packages/router-plugin/package.json (content)
⚔️ packages/router-plugin/src/core/code-splitter/compilers.ts (content)
⚔️ packages/router-plugin/src/core/constants.ts (content)
⚔️ packages/router-plugin/src/core/router-code-splitter-plugin.ts (content)
⚔️ packages/router-plugin/tests/code-splitter.test.ts (content)
⚔️ packages/router-plugin/tests/code-splitter/snapshots/react/1-default/inline@component.tsx (content)
⚔️ packages/router-plugin/tests/code-splitter/snapshots/react/1-default/inline@errorComponent.tsx (content)
⚔️ packages/router-plugin/tests/code-splitter/snapshots/react/1-default/inline@notFoundComponent.tsx (content)
⚔️ packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/inline@component---errorComponent---notFoundComponent---pendingComponent.tsx (content)
⚔️ packages/router-plugin/tests/code-splitter/snapshots/react/2-components-combined-loader-separate/inline@loader.tsx (content)
⚔️ packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/inline@component---loader---notFoundComponent---pendingComponent.tsx (content)
⚔️ packages/router-plugin/tests/code-splitter/snapshots/react/3-all-combined-errorComponent-separate/inline@errorComponent.tsx (content)
⚔️ packages/router-ssr-query-core/package.json (content)
⚔️ packages/router-vite-plugin/package.json (content)
⚔️ packages/solid-router-devtools/package.json (content)
⚔️ packages/solid-router-ssr-query/package.json (content)
⚔️ packages/solid-router/package.json (content)
⚔️ packages/solid-router/src/Asset.tsx (content)
⚔️ packages/solid-start-client/package.json (content)
⚔️ packages/solid-start-server/package.json (content)
⚔️ packages/solid-start/package.json (content)
⚔️ packages/start-client-core/package.json (content)
⚔️ packages/start-plugin-core/package.json (content)
⚔️ packages/start-plugin-core/src/prerender.ts (content)
⚔️ packages/start-plugin-core/src/start-compiler-plugin/compiler.ts (content)
⚔️ packages/start-plugin-core/src/start-compiler-plugin/plugin.ts (content)
⚔️ packages/start-plugin-core/tests/compiler.test.ts (content)
⚔️ packages/start-plugin-core/tests/prerender-ssrf.test.ts (content)
⚔️ packages/start-server-core/package.json (content)
⚔️ packages/start-server-core/src/createStartHandler.ts (content)
⚔️ packages/start-static-server-functions/package.json (content)
⚔️ packages/start-storage-context/package.json (content)
⚔️ packages/valibot-adapter/package.json (content)
⚔️ packages/vue-router-devtools/package.json (content)
⚔️ packages/vue-router-ssr-query/package.json (content)
⚔️ packages/vue-router/package.json (content)
⚔️ packages/vue-router/src/Asset.tsx (content)
⚔️ packages/vue-start-client/package.json (content)
⚔️ packages/vue-start-server/package.json (content)
⚔️ packages/vue-start/package.json (content)
⚔️ packages/zod-adapter/package.json (content)
⚔️ pnpm-lock.yaml (content)

These conflicts must be resolved before merging into main.
Resolve conflicts locally and push changes to this branch.
✅ Passed checks (4 passed)
Check nameStatusExplanation
Description Check✅ PassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title check✅ PassedTitle clearly and concisely summarizes the main change: passing pathname to global request middleware in createStartHandler.
Linked Issues check✅ PassedAll objectives from issue #6647 are met: pathname parameter added to both executeMiddleware calls with url.pathname, and comprehensive e2e regression tests added.
Out of Scope Changes check✅ PassedAll changes are directly related to fixing the pathname parameter in global request middleware and adding necessary regression tests.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
⚔️ Resolve merge conflicts (beta)
  • Auto-commit resolved conflicts to branch fix/pass-pathname-to-global-request-middleware
  • Post resolved changes as copyable diffs in a comment

No actionable comments were generated in the recent review. 🎉


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@schiller-manuel

Copy link
Copy Markdown
Collaborator

we need a regression test, probably best located in e2e/react-start/server-functions-global-middleware

@kkznch

Copy link
Copy Markdown
ContributorAuthor

Understood. Thanks for the guidance! I'll add a regression test to e2e/react-start/server-functions-global-middleware and update this PR shortly.

…anStack#6647)
Add e2e tests to server-functions-global-middleware verifying that
pathname is correctly passed to global request middleware in
createStartHandler.
- Add pathnameMiddleware that captures pathname from server callback
- Add dedicated pathname-middleware route and test page
- Verify pathname value on both SSR and client-side navigation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@kkznch

Copy link
Copy Markdown
ContributorAuthor

@schiller-manuel
I've added the e2e test to e2e/react-start/server-functions-global-middleware , covering both SSR and client-side navigation cases. Could you take a look?

Comment on lines +13 to +14
requestMiddlewarePathname: (context as any).requestMiddlewarePathname,
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

context should be typed properly. why as any?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@schiller-manuel
You're right — I've removed the as any cast. The middleware type system correctly infers requestMiddlewarePathname on the context. Pushed the fix.

The middleware type system correctly infers `requestMiddlewarePathname`
on the context, so the explicit cast is not needed.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@nx-cloud

nx-cloudBot commented Feb 14, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit 6c20cac

CommandStatusDurationResult
nx affected --targets=test:eslint,test:unit,tes...✅ Succeeded13m 46sView ↗
nx run-many --target=build --exclude=examples/*...✅ Succeeded28sView ↗

☁️ Nx Cloud last updated this comment at 2026-02-14 14:08:32 UTC

@pkg-pr-new

Copy link
Copy Markdown
More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/arktype-adapter@6648

@tanstack/eslint-plugin-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/eslint-plugin-router@6648

@tanstack/history

npm i https://pkg.pr.new/TanStack/router/@tanstack/history@6648

@tanstack/nitro-v2-vite-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/nitro-v2-vite-plugin@6648

@tanstack/react-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router@6648

@tanstack/react-router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-devtools@6648

@tanstack/react-router-ssr-query

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-ssr-query@6648

@tanstack/react-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start@6648

@tanstack/react-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-client@6648

@tanstack/react-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-server@6648

@tanstack/router-cli

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-cli@6648

@tanstack/router-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-core@6648

@tanstack/router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools@6648

@tanstack/router-devtools-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools-core@6648

@tanstack/router-generator

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-generator@6648

@tanstack/router-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-plugin@6648

@tanstack/router-ssr-query-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-ssr-query-core@6648

@tanstack/router-utils

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-utils@6648

@tanstack/router-vite-plugin

npm i https://pkg.pr.new/TanStack/router/@tanstack/router-vite-plugin@6648

@tanstack/solid-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router@6648

@tanstack/solid-router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router-devtools@6648

@tanstack/solid-router-ssr-query

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router-ssr-query@6648

@tanstack/solid-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start@6648

@tanstack/solid-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-client@6648

@tanstack/solid-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-server@6648

@tanstack/start-client-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-client-core@6648

@tanstack/start-fn-stubs

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-fn-stubs@6648

@tanstack/start-plugin-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-plugin-core@6648

@tanstack/start-server-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-server-core@6648

@tanstack/start-static-server-functions

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-static-server-functions@6648

@tanstack/start-storage-context

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-storage-context@6648

@tanstack/valibot-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/valibot-adapter@6648

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/TanStack/router/@tanstack/virtual-file-routes@6648

@tanstack/vue-router

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-router@6648

@tanstack/vue-router-devtools

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-router-devtools@6648

@tanstack/vue-router-ssr-query

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-router-ssr-query@6648

@tanstack/vue-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-start@6648

@tanstack/vue-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-start-client@6648

@tanstack/vue-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-start-server@6648

@tanstack/zod-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/zod-adapter@6648

commit: 6c20cac

@schiller-manuel
schiller-manuel merged commit 426c2b5 into TanStack:mainFeb 14, 2026
6 checks passed
Sheraff pushed a commit that referenced this pull request Feb 15, 2026
…#6648)
* fix: pass pathname to global request middleware in createStartHandler
The two `executeMiddleware` calls for global request middleware in
`createStartHandler` were missing the `pathname` property, causing it
to be `undefined` at runtime despite `RequestServerOptions` declaring
it as `pathname: string`.
- Add `pathname: url.pathname` to server function middleware execution
- Add `pathname: url.pathname` to page request middleware execution
The route-level middleware in `handleServerRoutes` already passes
`pathname` correctly.
Closes#6647
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: add regression test for pathname in global request middleware (#6647)
Add e2e tests to server-functions-global-middleware verifying that
pathname is correctly passed to global request middleware in
createStartHandler.
- Add pathnameMiddleware that captures pathname from server callback
- Add dedicated pathname-middleware route and test page
- Verify pathname value on both SSR and client-side navigation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: remove unnecessary `as any` cast from pathname middleware test
The middleware type system correctly infers `requestMiddlewarePathname`
on the context, so the explicit cast is not needed.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* ci: apply automated fixes
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Sign up for freeto 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.

pathname is undefined in global request middleware registered via createStart()

2 participants

@kkznch@schiller-manuel