-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
fix: pass in request when requestMiddleware is used in combination wi… #5390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…th server function fixes #5384
WalkthroughAdds a new request-middleware demo route and navigation, implements request propagation through Start context, replaces a server-context getter with a server-only context accessor, updates server function middleware resolution, and adds tests validating that request is available in request middleware for both loader and client calls. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant B as Browser
participant R as Route Loader
participant SF as Server Function
participant MW as Request Middleware
participant SC as Start Context
participant S as Start Server
Note over S,SC: Server initializes Start context per request
B->>R: Navigate to /middleware/request-middleware
R->>S: Invoke loader (server)
S->>SC: runWithStartContext({ contextAfterGlobalMiddlewares, request })
R->>SF: call serverFn()
SF->>SC: getStartContextServerOnly()
SC-->>SF: { contextAfterGlobalMiddlewares, request }
SF->>MW: execute middleware({ request, next })
MW-->>SF: next({ context: { requestParam, requestFunc }})
SF-->>R: { requestParam, requestFunc }
R-->>B: Render loader data
Note over B,SF: Client-triggered call
B->>SF: serverFn() via client
SF->>SC: getStartContextServerOnly() (server execution)
SC-->>SF: { contextAfterGlobalMiddlewares, request }
SF->>MW: execute middleware({ request, next })
MW-->>SF: next({ context: { requestParam, requestFunc }})
SF-->>B: { requestParam, requestFunc }
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (9)
💤 Files with no reviewable changes (1)
🧰 Additional context used📓 Path-based instructions (4)**/*.{ts,tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/src/routes/**📄 CodeRabbit inference engine (AGENTS.md)
Files:
e2e/**📄 CodeRabbit inference engine (AGENTS.md)
Files:
packages/{*-start,start-*}/**📄 CodeRabbit inference engine (AGENTS.md)
Files:
🧬 Code graph analysis (4)e2e/react-start/server-functions/src/routes/middleware/index.tsx (1)
packages/start-client-core/src/createServerFn.ts (1)
packages/start-client-core/src/getStartContextServerOnly.ts (1)
e2e/react-start/server-functions/src/routes/middleware/request-middleware.tsx (2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
🔇 Additional comments (11)
Comment |
View your CI Pipeline Execution ↗ for commit 28d5b99
☁️ Nx Cloud last updated this comment at |
More templates
@tanstack/arktype-adapter
@tanstack/directive-functions-plugin
@tanstack/eslint-plugin-router
@tanstack/history
@tanstack/nitro-v2-vite-plugin
@tanstack/react-router
@tanstack/react-router-devtools
@tanstack/react-router-ssr-query
@tanstack/react-start
@tanstack/react-start-client
@tanstack/react-start-server
@tanstack/router-cli
@tanstack/router-core
@tanstack/router-devtools
@tanstack/router-devtools-core
@tanstack/router-generator
@tanstack/router-plugin
@tanstack/router-ssr-query-core
@tanstack/router-utils
@tanstack/router-vite-plugin
@tanstack/server-functions-plugin
@tanstack/solid-router
@tanstack/solid-router-devtools
@tanstack/solid-start
@tanstack/solid-start-client
@tanstack/solid-start-server
@tanstack/start-client-core
@tanstack/start-plugin-core
@tanstack/start-server-core
@tanstack/start-static-server-functions
@tanstack/start-storage-context
@tanstack/valibot-adapter
@tanstack/virtual-file-routes
@tanstack/zod-adapter
commit: |
…th server function
fixes #5384
Summary by CodeRabbit
New Features
Refactor
Tests