-
Notifications
You must be signed in to change notification settings - Fork 329
SolidStart: expand docs on rendering modes #1308
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
base: main
Are you sure you want to change the base?
Changes from all commits
c83f957
28afce1
2e8d401
7a73d35
926ff16
08b8670
41d8ff0
3207564
4bdba75
a02ed4c
4d313c3
b7fb815
717bca0
c56434a
ea97511
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 | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,110 @@ | ||||||||||
| --- | ||||||||||
| title: "Rendering Modes" | ||||||||||
| --- | ||||||||||
|
|
||||||||||
| SolidStart has 3 kinds of rendering modes: | ||||||||||
|
|
||||||||||
| - `sync`: renders on server with `renderToString` and performs Client-Side Rendering (CSR) for asynchronous features. | ||||||||||
| - `async`: renders on server with `renderToStringAsync`. Blocking the response until all asynchronous data fetching is resolved. | ||||||||||
| - `stream` (default): renders on server with `renderToStream`. Streaming the response as soon as possible and continuing to fetch asynchronous data in the background, resolving the page as soon as possible and sending next chunks. | ||||||||||
|
|
||||||||||
| All modes have some degree of Server-Side Rendering, you may need to change them globally depending on your deployment provider. | ||||||||||
|
|
||||||||||
| ### Sync Mode | ||||||||||
|
|
||||||||||
| Uses [`renderToString`](/reference/rendering/render-to-string) to render the page from Solid's core to render the page synchronously. | ||||||||||
| All async features are disabled and the page is rendered as soon as possible and sent to the client-side where data fetching will happen post-hydration. | ||||||||||
|
|
||||||||||
| :::caution[Page Components] | ||||||||||
| In SolidStart, all page components are lazy-loaded by default. This means that `renderToString` will SSR only until `app.tsx` and the route components will be rendered client-side. | ||||||||||
| ::: | ||||||||||
|
|
||||||||||
| Asynchronous features will be directly impacted since rendering will mostly happen on the client-side. | ||||||||||
|
|
||||||||||
| - Data-fetching: client-side only, first load will render Suspense fallbacks. | ||||||||||
| - Time To First Byte (TTFB): fast since the server-side rendering is minimal. | ||||||||||
| - Total page load time: slower since the client-side rendering is heavier. | ||||||||||
|
|
||||||||||
| ### Async Mode | ||||||||||
|
|
||||||||||
| Uses [`renderToStringAsync`](/reference/rendering/render-to-string-async) to render the page from Solid's core to render the page asynchronously. | ||||||||||
| Uses [`renderToStringAsync`](/reference/rendering/render-to-string-async) from Solid's core to render the page asynchronously. | ||||||||||
|
||||||||||
| Uses [`renderToStringAsync`](/reference/rendering/render-to-string-async) from Solid's core to render the page asynchronously. |
Copilot
AI
Oct 26, 2025
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.
The description at line 38 appears to be misplaced in the Async Mode section. This line describes stream mode functionality but is located within the Async Mode section (after line 37 which discusses server-side features for async mode). It should either be removed from this section or the section structure needs to be corrected.
Copilot
AI
Oct 26, 2025
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.
The options parameter should be a function that returns an object with a mode property, but the signature shows it can also be just an object. The example wraps the mode in a function that returns an object, but based on the type signature in create-handler.mdx (line 35), when using a function, it should return { mode: RenderingModes } directly. The current example has an unnecessary wrapper function—it should be (event) => ({ mode: event.request.url.includes(\"/special-route\") ? \"async\" : \"stream\" }).
| mode: (event) => { | |
| return { mode: event.request.url.includes("/special-route") ? "async" : "stream" }; | |
| } | |
| mode: (event) => ({ mode: event.request.url.includes("/special-route") ? "async" : "stream" }) |
Copilot
AI
Oct 26, 2025
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.
Same issue as Comment 3: The function should directly return the object ({ mode: isBot(event.request.userAgent) ? \"async\" : \"stream\" }) without the explicit return statement and extra braces, to match the type signature.
| mode: (event) => { | |
| return { mode: isBot(event.request.userAgent) ? "async" : "stream" }; | |
| } | |
| mode: (event) => ({ mode: isBot(event.request.userAgent) ? "async" : "stream" }) |
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.
The phrase 'to render the page' is repeated. Remove the first occurrence to read: 'Uses
renderToStringfrom Solid's core to render the page synchronously.'