-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
perf(solid-start): 51% improvement #6615
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,10 +2,13 @@ import * as Solid from 'solid-js/web' | |
| import { isbot } from 'isbot' | ||
| import { transformReadableStreamWithRouter } from '@tanstack/router-core/ssr/server' | ||
| import { makeSsrSerovalPlugin } from '@tanstack/router-core' | ||
| import { FastResponse } from 'srvx' | ||
| import type { JSXElement } from 'solid-js' | ||
| import type { ReadableStream } from 'node:stream/web' | ||
| import type { AnyRouter } from '@tanstack/router-core' | ||
|
|
||
| globalThis.Response = FastResponse | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do not mutate Overwriting
Instead, use Proposed fix import { FastResponse } from 'srvx'
-
-globalThis.Response = FastResponse
...
- return new Response(responseStream as any, {
+ return new FastResponse(responseStream as any, {
status: router.state.statusCode,
headers: responseHeaders,
})🤖 Prompt for AI Agents |
||
|
|
||
| export const renderRouterToStream = async ({ | ||
| request, | ||
| router, | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: TanStack/router
Length of output: 4369
🌐 Web query:
srvx npm package💡 Result:
srvxis an npm package that provides a universal server API based on Web Platform standards (afetch(req: Request)handler), designed to run consistently across Node.js, Deno, and Bun, with a zero-dependency core and a CLI that includes watching, logging, error handling, and static file serving. [1][2]srvx.h3.dev[2]h3js/srvxon GitHub [1]0.9.x(e.g.,0.9.8). [3][4]Quick start (CLI)
Create
server.ts:Run:
npx srvxdeno -A npm:srvxbunx --bun srvx[2][1]Quick start (library API)
[5]
Sources: [1] GitHub repo, [2] official site, [3] Socket package index, [4] jsDelivr package page, [5] Libraries.io page.
Global mutation of
Responseconflicts with"sideEffects": falsedeclaration.The code assigns
globalThis.Response = FastResponse(in the solid-router Solid.js entry point), which is a side effect. However, this package.json declares"sideEffects": falseon line 95. Bundlers may tree-shake the module entirely, silently dropping theResponseassignment and negating the performance optimization.Recommended fixes:
"sideEffects": trueto ensure bundlers include this module.srvxdependency, consider using~0.11.2instead of^0.11.2to avoid minor-version breaking changes.🤖 Prompt for AI Agents