Skip to content

Commit 717bca0

Browse files
committed
big rewording
1 parent b7fb815 commit 717bca0

1 file changed

Lines changed: 32 additions & 17 deletions

File tree

src/routes/solid-start/building-your-application/rendering-modes.mdx

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,58 @@
22
title: "Rendering Modes"
33
---
44

5-
SolidStart has 3 kinds of rendering modes: `sync`, `async`, and `stream`.
6-
Let's talk about how each of them work and which one to pick.
5+
SolidStart has 3 kinds of rendering modes:
76

8-
:::note
9-
Default is **stream** and performance-wise should be preferred as a rule-of-thumb.
10-
:::
7+
- `sync`: renders on server with `renderToString` and performs Client-Side Rendering (CSR) for asynchronous features.
8+
- `async`: renders on server with `renderToStringAsync`. Blocking the response until all asynchronous data fetching is resolved.
9+
- `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.
1110

1211
All modes have some degree of Server-Side Rendering, you may need to change them globally depending on your deployment provider.
13-
And you may prefer to override them for better bot support and SEO.
14-
15-
## Impacted Features
16-
17-
| Feature | sync | async | stream |
18-
| -------------------- | ----------- | --------------------------- | ----------------------- |
19-
| Data fetching | Client-side | Server-side (blocking) | Server-side (streaming) |
20-
| Suspense fallbacks | Yes | No | Yes |
21-
| Time to first byte | Fast | Slower (waits for all data) | Faster |
22-
| Total page load time | Slower | Fast (server fetches) | Faster (progressive) |
2312

2413
### Sync Mode
2514

2615
Uses [`renderToString`](/reference/rendering/render-to-string) to render the page from Solid's core to render the page synchronously.
2716
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.
2817

18+
:::caution[Page Components]
19+
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.
20+
:::
21+
22+
Asynchronous features will be directly impacted since rendering will mostly happen on the client-side.
23+
24+
- Data-fetching: client-side only, first load will render Suspense fallbacks.
25+
- Time To First Byte (TTFB): fast since the server-side rendering is minimal.
26+
- Total page load time: slower since the client-side rendering is heavier.
27+
2928
### Async Mode
3029

3130
Uses [`renderToStringAsync`](/reference/rendering/render-to-string-async) to render the page from Solid's core to render the page asynchronously.
3231
All Suspense boundaries are resolved and rendered before being sent to the client-side.
3332

33+
:::tip[SEO and Bot Support]
3434
No suspense fallbacks are shown in the browser, which makes this mode ideal for SEO optimizations and bot support.
35+
:::
36+
37+
Asynchronous features will happen in the Server-Side during first render.
38+
39+
- **Data-fetching**: first render will be similar to sync mode, but data fetching will still happen in the background and responses will be streamed in chunks as available.
40+
- **Time To First Byte (TTFB)**: slower since the server-side rendering is heavier.
41+
- **Total page load time**: faster than sync mode since the server-side tends to be faster than the client-side.
3542

36-
### Stream Mode
43+
### Stream Mode (default)
3744

3845
Uses [`renderToStream`](/reference/rendering/render-to-stream) to render the page from Solid's core to render the page streaming.
3946
Leveraging [TransformableStream](https://developer.mozilla.org/en-US/docs/Web/API/TransformStream) to progressively send the HTML to the client-side.
4047

41-
This mode is ideal for performance and future-friendly apps.
48+
:::tip[Performance and Future-Friendly Apps]
49+
This mode is ideal for performance and future-friendly apps. It provides best perceived performance and consumes less memory and CPU from the client-side.
50+
:::
51+
52+
Asynchronous features will happen in the Server-Side during first render.
53+
54+
- **Data-fetching**: server-side only, data fetching will happen in the background and the page will be rendered as soon as possible.
55+
- **Time To First Byte (TTFB)**: faster since the server-side rendering is lighter.
56+
- **Total page load time**: faster since the server-side tends to be faster than the client-side.
4257

4358
## Global Configuration
4459

0 commit comments

Comments
 (0)