perf(history): use lightweight history for server rendering - #8354
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (11)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughSSR now uses fixed request-scoped server history. Server navigation methods are no-ops. Router and Start handlers use the new history, with tests and documentation covering normalization, redirects, and unchanged request locations. ChangesSSR server navigation
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Feature Sequence Diagram(s)sequenceDiagram
participant SSRHandler
participant ServerHistory
participant RouterCore
participant HTTPResponse
SSRHandler->>ServerHistory: createServerHistory(request href)
SSRHandler->>RouterCore: load request
RouterCore->>ServerHistory: navigation request
ServerHistory-->>RouterCore: retain fixed request location
RouterCore->>HTTPResponse: return redirect response when redirect() is thrown
Merge Risk: ⚪ Minimal · up to SSR navigation preserves the request location while redirects continue to return HTTP redirect responses. No actionable merge risk remains. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 8 files. (3 skipped: 3 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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. Comment |
|
View your CI Pipeline Execution ↗ for commit 7649ecf
☁️ Nx Cloud last updated this comment at |
🚀 Changeset Version Preview3 package(s) bumped directly, 21 bumped as dependents. 🟩 Patch bumps
|
Bundle Size BenchmarksThis pull request does not affect bundle size in any measured scenario. |
There was a problem hiding this comment.
Important
At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.
Nx Cloud has identified a possible root cause for your failed CI:
We classified this failure as an environment state issue rather than a code change. The error originates in a stale build artifact (e2e/e2e-utils/dist/esm/index.js) of a package untouched by this PR, and the same failure does not appear on main. Rebuilding the CI environment's dist artifacts should resolve it.
No code changes were suggested for this issue.
Trigger a rerun:
🎓 Learn more about Self-Healing CI on nx.dev
Merging this PR will improve performance by 6.27%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ | Simulation | ssr server-route (vue) |
155.2 ms | 141.3 ms | +9.8% |
| ⚡ | Simulation | ssr global-mw server-route (solid) |
205 ms | 188.4 ms | +8.85% |
| ⚡ | Simulation | ssr global-mw server-route (react) |
210.2 ms | 193.8 ms | +8.42% |
| ⚡ | Simulation | ssr global-mw server-route (vue) |
208.5 ms | 193.5 ms | +7.75% |
| ⚡ | Simulation | ssr not-found (solid) |
179 ms | 169.2 ms | +5.75% |
| ⚡ | Simulation | ssr server-route middleware (vue) |
162.6 ms | 155.1 ms | +4.83% |
| ⚡ | Simulation | ssr server-route middleware (solid) |
160.4 ms | 153.2 ms | +4.7% |
| ⚡ | Simulation | ssr server-route middleware (react) |
163.7 ms | 156.4 ms | +4.67% |
| ⚡ | Simulation | ssr server-route (solid) |
144.6 ms | 138.7 ms | +4.23% |
| ⚡ | Simulation | ssr server-route (react) |
148.7 ms | 143.1 ms | +3.92% |
Tip
Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.
Comparing codex/server-history (7649ecf) with main (6494e75)
…cript 7 @sixthshift/design-system 0.4.0 → 0.5.0, @tanstack/react-router 1.170.36, @tanstack/react-start 1.168.54, @tanstack/start-storage-context 1.167.32, vite 8.3.0, zod 4.6.5, typescript 7.0.2 (the native compiler; tsc --noEmit passes and still catches a planted error). Router-core 1.171.30 (TanStack/router#8354) makes router.navigate a no-op when the router believes it is on the server, which under vitest it is. The client-scale test simulated pressing plus with navigate; it now writes the built href to the history and loads, which is what navigate does in a browser. The lockfile was regenerated from scratch while chasing that, so its diff is larger than the bumps alone. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
🎯 Changes
SSR handlers currently allocate a full memory history for each request, including a navigation stack and per-instance callbacks. Add
createServerHistoryto@tanstack/historyand use it in Router and Start SSR handlers. It keeps one request location, shares methods, and uses the same href normalization as browser history.Server calls to
navigate,buildAndCommitLocation, andcommitLocationnow resolve without changing the location or starting another load. HTTP redirects continue to useredirect(). These guards use the existingisServerflag, preserving client navigation behavior.Includes regression coverage for href normalization, request isolation, no-op server navigation, HTTP redirects, and client push/replace behavior, plus SSR documentation updates.
Previously validated locally: 3,405 tests passed across history, Router Core, and Start server, along with their type, lint, and package build checks. No additional checks were run when opening this PR.
✅ Checklist
🚀 Release Impact
Summary by CodeRabbit
New Features
createServerHistoryfor server request handlers.Documentation
Bug Fixes