Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
39f3b9f
Fix useSubmission
amirhhashemi May 16, 2025
f3c6bd0
Update
amirhhashemi Jun 8, 2025
e9d0891
Update
amirhhashemi Jun 11, 2025
5a7ec5c
Update info callout titles (#1207)
amirhhashemi Jun 18, 2025
aec869e
update
amirhhashemi Jul 2, 2025
73da3ce
update
amirhhashemi Jul 3, 2025
ebd6265
Merge branch 'main' into fix-use-submission-situation
kodiakhq[bot] Jul 30, 2025
b505134
Merge branch 'main' into fix-use-submission-situation
kodiakhq[bot] Aug 1, 2025
207a728
Merge branch 'main' into fix-use-submission-situation
kodiakhq[bot] Aug 13, 2025
e138cd6
update
amirhhashemi Aug 5, 2025
9c274ac
update
amirhhashemi Aug 9, 2025
eb6d2e0
update
amirhhashemi Aug 14, 2025
bca58d4
update
amirhhashemi Aug 16, 2025
08af13a
Merge branch 'main' into fix-use-submission-situation
kodiakhq[bot] Aug 16, 2025
f36f2f8
Merge branch 'main' into fix-use-submission-situation
kodiakhq[bot] Aug 20, 2025
bf29f48
Merge branch 'main' into fix-use-submission-situation
kodiakhq[bot] Aug 20, 2025
65900a3
update
amirhhashemi Aug 23, 2025
01f6654
update
amirhhashemi Aug 24, 2025
319c28d
update
amirhhashemi Aug 25, 2025
a1cad3c
update
amirhhashemi Aug 25, 2025
0eff6f4
update
amirhhashemi Aug 25, 2025
da0fa78
Update src/routes/solid-router/concepts/queries.mdx
amirhhashemi Aug 26, 2025
d164be5
Update src/routes/solid-router/concepts/queries.mdx
amirhhashemi Aug 26, 2025
7f04981
Update src/routes/solid-router/concepts/queries.mdx
amirhhashemi Aug 26, 2025
a3f4d0c
Update src/routes/solid-router/concepts/queries.mdx
amirhhashemi Aug 26, 2025
b6a2b2d
Update src/routes/solid-router/concepts/queries.mdx
amirhhashemi Aug 26, 2025
784bb63
Update src/routes/solid-router/concepts/queries.mdx
amirhhashemi Aug 26, 2025
5fe813a
Update src/routes/solid-router/concepts/queries.mdx
amirhhashemi Aug 26, 2025
3f72aca
Update src/routes/solid-router/concepts/queries.mdx
amirhhashemi Aug 26, 2025
972cc02
Update src/routes/solid-router/concepts/queries.mdx
amirhhashemi Aug 26, 2025
e4cdc46
Update src/routes/solid-router/concepts/queries.mdx
amirhhashemi Aug 26, 2025
68aa8a6
Update src/routes/solid-router/concepts/queries.mdx
amirhhashemi Aug 26, 2025
51c9c7d
Update src/routes/solid-start/guides/data-fetching.mdx
amirhhashemi Aug 26, 2025
8f2a98e
Update src/routes/solid-start/guides/data-fetching.mdx
amirhhashemi Aug 26, 2025
8cc3137
apply review results
amirhhashemi Aug 26, 2025
9d3df64
experiment with new structure
amirhhashemi Aug 26, 2025
808d4d7
fix dependabot
LadyBluenotes Aug 20, 2025
afe0b28
chore: move Dependabot config to .github/dependabot.yml (#1232)
iyiolacak Aug 30, 2025
cb0cc3d
Bump glob from 11.0.2 to 11.0.3 (#1234)
dependabot[bot] Aug 30, 2025
5c32406
Bump @typescript-eslint/parser from 8.40.0 to 8.41.0 (#1236)
dependabot[bot] Aug 30, 2025
433811a
Bump prettier-plugin-tailwindcss from 0.6.13 to 0.6.14 (#1237)
dependabot[bot] Aug 30, 2025
0fc38dd
Bump prettier from 3.5.3 to 3.6.2 (#1238)
dependabot[bot] Aug 30, 2025
2f47c0b
fix title tag during ssr (#1239)
brenelz Aug 30, 2025
40c2f27
fix error
LadyBluenotes Aug 30, 2025
1cc01bc
update eslint config and deps (#1243)
LadyBluenotes Aug 31, 2025
da4c7d4
change npm init solid text (#1241)
brenelz Aug 31, 2025
149c05e
add section about using revalidate together with redirect (#1240)
brenelz Aug 31, 2025
70319f8
Bump eslint from 9.33.0 to 9.34.0 (#1244)
dependabot[bot] Sep 2, 2025
1d13fc9
Bump @eslint/js from 9.33.0 to 9.34.0 (#1246)
dependabot[bot] Sep 2, 2025
408988e
Bump @typescript-eslint/eslint-plugin from 8.40.0 to 8.41.0 (#1247)
dependabot[bot] Sep 2, 2025
80c9c0b
Bump shiki from 3.12.0 to 3.12.1 (#1248)
dependabot[bot] Sep 2, 2025
8a2cdca
Spellcheck Workflow (#1249)
LadyBluenotes Sep 3, 2025
f0e324d
add sarif file
LadyBluenotes Sep 3, 2025
e40c8c0
upload sarif
LadyBluenotes Sep 3, 2025
31e3b72
Update workflows (#1250)
LadyBluenotes Sep 3, 2025
8ea471c
Closes issues #649 and #968 (#1251)
thomasbuilds Sep 7, 2025
cc55b32
Addresses Issue #1183 (#1252)
thomasbuilds Sep 8, 2025
42a5424
Bump @types/node from 24.3.0 to 24.3.1 (#1254)
dependabot[bot] Sep 8, 2025
514b90e
Bump eslint from 9.34.0 to 9.35.0 (#1256)
dependabot[bot] Sep 8, 2025
d9284ca
Bump dotenv from 17.2.1 to 17.2.2 (#1255)
dependabot[bot] Sep 8, 2025
06dddaf
Bump @typescript-eslint/parser from 8.41.0 to 8.43.0 (#1257)
dependabot[bot] Sep 9, 2025
92323f4
Bump typescript-eslint from 8.41.0 to 8.43.0 (#1258)
dependabot[bot] Sep 9, 2025
3a1ca6f
remove random `;` symbol from splitProps docs (#1260)
JLarky Sep 11, 2025
2b49398
Addresses #547 (#1253)
thomasbuilds Sep 12, 2025
ac86f37
Addressed issue #1259 (#1262)
thomasbuilds Sep 14, 2025
a0dc8fa
Fix code example error in create-effect.mdx (#1261)
WavJaby Sep 14, 2025
6d004b9
Bump zod from 4.1.5 to 4.1.8 (#1268)
dependabot[bot] Sep 16, 2025
c62d8cf
Bump @solidjs/start from 1.1.7 to 1.2.0 (#1266)
dependabot[bot] Sep 16, 2025
d118a04
Bump @eslint/js from 9.34.0 to 9.35.0 (#1265)
dependabot[bot] Sep 16, 2025
ac262ac
Bump globals from 16.3.0 to 16.4.0 (#1267)
dependabot[bot] Sep 16, 2025
4e833e4
Remove "variables" from createEffect dependency examples (#1269)
Mind-of-Apollo Sep 17, 2025
dca2c5e
Bump @types/node from 24.3.1 to 24.5.0 (#1264)
dependabot[bot] Sep 17, 2025
69f9e31
Bump @typescript-eslint/parser from 8.43.0 to 8.44.1 (#1273)
dependabot[bot] Sep 22, 2025
968fcee
Bump shiki from 3.12.1 to 3.13.0 (#1275)
dependabot[bot] Sep 22, 2025
52d631e
Bump @types/node from 24.5.1 to 24.5.2 (#1276)
dependabot[bot] Sep 22, 2025
6cf9d74
Bump @eslint/js from 9.35.0 to 9.36.0 (#1277)
dependabot[bot] Sep 22, 2025
ce6f868
Bump zod from 4.1.8 to 4.1.11 (#1278)
dependabot[bot] Sep 22, 2025
564732d
Bump @typescript-eslint/eslint-plugin from 8.41.0 to 8.43.0 (#1274)
dependabot[bot] Sep 23, 2025
4cc9e05
Update Geist font (#1281)
amirhhashemi Sep 28, 2025
610603a
Bump typescript-eslint from 8.43.0 to 8.45.0 (#1283)
dependabot[bot] Sep 30, 2025
6b96aec
Bump @types/node from 24.5.2 to 24.6.0 (#1287)
dependabot[bot] Sep 30, 2025
b5af6b5
Bump @tailwindcss/typography from 0.5.16 to 0.5.19 (#1285)
dependabot[bot] Sep 30, 2025
c478cb6
Bump eslint from 9.35.0 to 9.36.0 (#1284)
dependabot[bot] Sep 30, 2025
3f8014b
Bump @typescript-eslint/parser from 8.44.1 to 8.45.0 (#1286)
dependabot[bot] Sep 30, 2025
22d560f
Closes #1288 (#1289)
thomasbuilds Oct 6, 2025
21f257c
Remove deprecated Auto Minify note from Cloudflare deployment docs (#…
yihyunjoon Oct 6, 2025
2ca5edb
Update getting-started.mdx (#1298)
shamsartem Oct 7, 2025
b33dc05
update dependabot
LadyBluenotes Oct 7, 2025
9306ac7
Bump typescript-eslint from 8.45.0 to 8.46.0 (#1293)
dependabot[bot] Oct 7, 2025
c2e496f
Bump @typescript-eslint/parser from 8.45.0 to 8.46.0 (#1294)
dependabot[bot] Oct 7, 2025
ae81388
Bump @types/node from 24.6.0 to 24.7.0 (#1296)
dependabot[bot] Oct 7, 2025
cdb1280
Bump eslint from 9.36.0 to 9.37.0 (#1297)
dependabot[bot] Oct 7, 2025
6b0ef5c
Bump zod from 4.1.11 to 4.1.12 (#1295)
dependabot[bot] Oct 7, 2025
3f7bdcb
Bump typescript from 5.9.2 to 5.9.3 (#1303)
dependabot[bot] Oct 14, 2025
e19acfa
Bump dotenv from 17.2.2 to 17.2.3 (#1302)
dependabot[bot] Oct 14, 2025
acdbc90
Bump @typescript-eslint/eslint-plugin from 8.44.1 to 8.46.0 (#1299)
dependabot[bot] Oct 14, 2025
dbb098f
Bump @typescript-eslint/parser from 8.46.0 to 8.46.1 (#1301)
dependabot[bot] Oct 14, 2025
bd8c957
chore: update lockfile and rm lunaria (#1304)
LadyBluenotes Oct 16, 2025
5b9f2f3
amend explanation of css file imports (#1305)
Fake-User Oct 20, 2025
28eb899
Bump @typescript-eslint/eslint-plugin from 8.46.0 to 8.46.1 (#1312)
dependabot[bot] Oct 20, 2025
47e314e
Bump @eslint/js from 9.36.0 to 9.38.0 (#1310)
dependabot[bot] Oct 20, 2025
b8a6bd5
Bump typescript-eslint from 8.46.0 to 8.46.2 (#1309)
dependabot[bot] Oct 20, 2025
64ffc0e
Revise security guidelines for XSS and CSR (#1307)
titoBouzout Oct 21, 2025
5581d0b
Bump @kobalte/solidbase from 0.2.17 to 0.2.19 (#1311)
dependabot[bot] Oct 21, 2025
11fde8f
Refine signal tracking explanation in intro-to-reactivity (#1316)
titoBouzout Oct 26, 2025
f0db094
Seed routes for prerendering (#1319)
titoBouzout Oct 27, 2025
48f87cc
Generate `llm.txt` on build (#1317)
atilafassina Oct 27, 2025
37a7a71
Removes duplicate search results from search, and fix incorrect URLs …
titoBouzout Oct 28, 2025
c32ed05
Documentation metadata via Frontmatter (#1321)
davedbase Oct 28, 2025
dcb9e60
Bump prettier-plugin-tailwindcss from 0.6.14 to 0.7.1 (#1322)
dependabot[bot] Oct 28, 2025
ef18238
Bump @typescript-eslint/parser from 8.46.1 to 8.46.2 (#1323)
dependabot[bot] Oct 28, 2025
209cd1a
Bump @types/node from 24.7.0 to 24.9.1 (#1325)
dependabot[bot] Oct 28, 2025
d07937b
Bump shiki from 3.13.0 to 3.14.0 (#1324)
dependabot[bot] Oct 28, 2025
28d11bb
Fix broken link that crashes pre-rendering (#1326)
titoBouzout Oct 28, 2025
d9bc62b
Additional changes to documentation metadata (#1328)
davedbase Oct 31, 2025
a5a14ec
Bump @eslint/js from 9.38.0 to 9.39.1 (#1332)
dependabot[bot] Nov 4, 2025
770ff46
Bump @types/node from 24.9.1 to 24.10.0 (#1334)
dependabot[bot] Nov 4, 2025
8499a8e
Bump eslint from 9.37.0 to 9.39.1 (#1335)
dependabot[bot] Nov 4, 2025
425d0b1
Improve styling of tables containing large inline code (#1337)
amirhhashemi Nov 8, 2025
0b44695
Improve `createEffect` and `createRenderEffect` reference (#1330)
amirhhashemi Nov 9, 2025
3f7dd8c
Improve `createRoot` reference (#1336)
amirhhashemi Nov 9, 2025
934734c
Merge branch 'pr-1179' of https://github.com/solidjs/solid-docs into …
LadyBluenotes Nov 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/middleware/legacy-routes-redirect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ const LEGACY_ROUTES = {

"/solid-router/reference/response-helpers/revalidate":
"/solid-router/reference/data-apis/revalidate",

"/solid-start/guides/data-loading": "/solid-start/guides/data-fetching",
} as const;

function isLegacyRoute(path: string): path is keyof typeof LEGACY_ROUTES {
Expand Down
470 changes: 382 additions & 88 deletions src/routes/solid-router/concepts/actions.mdx

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion src/routes/solid-router/concepts/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"nesting.mdx",
"layouts.mdx",
"alternative-routers.mdx",
"queries.mdx",
"actions.mdx"
]
}
}
4 changes: 4 additions & 0 deletions src/routes/solid-router/data-fetching/data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"title": "Data fetching",
"pages": ["queries.mdx", "streaming.mdx", "revalidation.mdx", "how-to"]
}
4 changes: 4 additions & 0 deletions src/routes/solid-router/data-fetching/how-to/data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"title": "How to",
"pages": ["preload-data.mdx", "handle-error-and-loading-states.mdx"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: "Handle pending and error states"
---

The `createAsync` primitive is designed to work with Solid's native components for managing asynchronous states.
It reports its pending state to the nearest [`<Suspense>` boundary](/reference/components/suspense) to display loading fallbacks, and propagate errors to an [`<ErrorBoundary>`](/reference/components/error-boundary) for handling and displaying error messages.

```tsx
import { Suspense, ErrorBoundary, For } from "solid-js";
import { query, createAsync } from "@solidjs/router";

const getNewsQuery = query(async () => {
// ... Fetches the latest news from an API.
}, "news");

function NewsFeed() {
const news = createAsync(() => getNewsQuery());

return (
<ErrorBoundary fallback={<p>Could not fetch news.</p>}>
<Suspense fallback={<p>Loading news...</p>}>
<ul>
<For each={news()}>{(item) => <li>{item.headline}</li>}</For>
</ul>
</Suspense>
</ErrorBoundary>
);
}
```
54 changes: 54 additions & 0 deletions src/routes/solid-router/data-fetching/how-to/preload-data.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
title: "Preload data"
---

Preloading data improves perceived performance by fetching the data for an upcoming page before the user navigates to it.

Solid Router initiates preloading in two scenarios:

- When a user indicates intent to navigate to the page (e.g., by hovering over a link).
- When the route's component is rendering.

This ensures data fetching starts as early as possible, often making data ready once the component renders.

Preloading is configured using the [`preload`](/solid-router/reference/preload-functions/preload) prop on a [`Route`](/solid-router/reference/components/route).
This prop accepts a function that calls one or more queries.
When triggered, the queries execute and their results are stored in a short-lived internal cache.
Once the user navigates and the destination route’s component renders, any `createAsync` calls within the page will consume the preloaded data.
Thanks to the [deduplication mechanism](#deduplication), no redundant network requests are made.

```tsx {18-20,27}
import { Show } from "solid-js";
import { Route, query, createAsync } from "@solidjs/router";

const getProductQuery = query(async (id: string) => {
// ... Fetches product details for the given ID.
}, "product");

function ProductDetails(props) {
const product = createAsync(() => getProductQuery(props.params.id));

return (
<Show when={product()}>
<h1>{product().name}</h1>
</Show>
);
}

function preloadProduct({ params }: { params: { id: string } }) {
getProductQuery(params.id);
}

function Routes() {
return (
<Route
path="/products/:id"
component={ProductDetails}
preload={preloadProduct}
/>
);
}
```

In this example, hovering a link to `/products/:id` triggers `preloadProduct`.
When the `ProductDetails` component renders, its `createAsync` call will instantly resolve with the preloaded data.
81 changes: 81 additions & 0 deletions src/routes/solid-router/data-fetching/queries.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
title: "Queries"
---

Queries are the core building blocks for data fetching in Solid Router.
They provide an elegant solution for managing data fetching.

## Defining queries

They are defined using the [`query` function](/solid-router/reference/data-apis/query).
It wraps the data-fetching logic and extends it with powerful capabilities like [request deduplication](#deduplication) and [automatic revalidation](#revalidation).

The `query` function takes two parameters: a **fetcher** and a **name**.

- The **fetcher** is an asynchronous function that fetches data from any source, such as a remote API.
- The **name** is a unique string used to identify the query.
When a query is called, Solid Router uses this name and the arguments passed to the query to create a unique key, which is used for the internal deduplication mechanism.

```tsx
import { query } from "@solidjs/router";

const getUserProfileQuery = query(async (userId: string) => {
const response = await fetch(
`https://api.example.com/users/${encodeURIComponent(userId)}`
);
const json = await response.json();

if (!response.ok) {
throw new Error(json?.message ?? "Failed to load user profile.");
}

return json;
}, "userProfile");
```

In this example, the defined query fetches a user's profile from an API.
If the request fails, the fetcher will throw an error that will be caught by the nearest [`<ErrorBoundary>`](/reference/components/error-boundary) in the component tree.

## Using queries in components

Defining a query does not by itself fetch any data.
To access its data, the query can be used with the [`createAsync` primitive](/solid-router/reference/data-apis/create-async).
`createAsync` takes an asynchronous function, such as a query, and returns a signal that tracks its result.

```tsx
import { For, Show } from "solid-js";
import { query, createAsync } from "@solidjs/router";

const getArticlesQuery = query(async () => {
// ... Fetches a list of articles from an API.
}, "articles");

function Articles() {
const articles = createAsync(() => getArticlesQuery());

return (
<Show when={articles()}>
<For each={articles()}>{(article) => <p>{article.title}</p>}</For>
</Show>
);
}
```

In this example, `createAsync` is used to call the query.
Once the query completes, `articles` holds the result, which is then rendered.

:::tip
When working with complex data types, such as arrays or deeply nested objects, the [`createAsyncStore` primitive](/solid-router/reference/data-apis/create-async-store) offers a more ergonomic and performant solution.
It works like `createAsync`, but returns a [store](/concepts/stores) for easier state management..
:::

## Deduplication

A key feature of queries is their ability to deduplicate requests, preventing redundant data fetching in quick succession.

One common use case is preloading: when a user hovers over a link, the application can begin preloading the data for the destination page.
If the user then clicks the link, the query has already been completed, and the data is available instantly without triggering another network request.
This mechanism is fundamental to the performance of Solid Router applications.

Deduplication also applies when multiple components on the same page use the same query.
As long as at least one component is actively using the query, Solid Router will reuse the cached result instead of refetching the data.
60 changes: 60 additions & 0 deletions src/routes/solid-router/data-fetching/revalidation.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
title: "Revalidation"
---

Since server data can change, Solid Router provides mechanisms to revalidate queries and keep the UI up to date.

The most common case is **automatic revalidation**.
After an [action](/solid-router/concepts/actions) completes successfully, Solid Router automatically revalidates all active queries on the page.
For more details, see the [actions documentation](/solid-router/concepts/actions#automatic-data-revalidation).

For more fine-grained control, you can trigger revalidation manually with the [`revalidate` function](/solid-router/reference/data-apis/revalidate).
It accepts a query key (or an array of keys) to target specific queries.
Each query exposes two properties for this: `key` and `keyFor`.

- `query.key` is the base key for a query and targets all of its instances.
Using this key will revalidate all data fetched by that query, regardless of the arguments provided.
- `query.keyFor(arguments)` generates a key for a specific set of arguments, allowing you to target and revalidate only that particular query.

```tsx
import { For } from "solid-js";
import { query, createAsync, revalidate } from "@solidjs/router";

const getProjectsQuery = query(async () => {
// ... Fetches a list of projects.
}, "projects");

const getProjectTasksQuery = query(async (projectId: string) => {
// ... Fetches a list of tasks for a project.
}, "projectTasks");

function Projects() {
const projects = createAsync(() => getProjectsQuery());

function refetchAllTasks() {
revalidate(getProjectTasksQuery.key);
}

return (
<div>
<button onClick={refetchAllTasks}>Refetch all tasks</button>
<For each={projects()}>{(project) => <Project id={project.id} />}</For>
</div>
);
}

function Project(props: { id: string }) {
const tasks = createAsync(() => getProjectTasksQuery(props.id));

function refetchTasks() {
revalidate(getProjectTasksQuery.keyFor(props.id));
}

return (
<div>
<button onClick={refetchTasks}>Refetch tasks for this project</button>
<For each={project.tasks}>{(task) => <div>{task.title}</div>}</For>
</div>
);
}
```
90 changes: 90 additions & 0 deletions src/routes/solid-router/data-fetching/streaming.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
---
title: "Streaming"
---

In traditional server-rendered applications, the server must fetch all data before rendering and sending the page to the browser.
If some queries are slow, this delays the initial load.
**Streaming** solves this by sending the page’s HTML shell immediately and progressively streaming data-dependent sections as they become ready.

When a query is accessed during a server-side render, Solid suspends the UI until the data resolves.
By default, this suspension affects the entire page.

To control this behavior, you can use suspense boundaries - regions of the component tree defined by a [`<Suspense>` component](/reference/components/suspense).
It isolates asynchronous behavior to a specific section of the page.

Content inside the boundary is managed by Solid’s concurrency system: if it isn’t ready, the boundary’s fallback UI is shown while the rest of the page renders and streams immediately.
Once the data resolves, the server streams the final HTML for that section, replacing the fallback and letting users see and interact with most of the page much sooner.

```tsx
import { Suspense, For } from "solid-js";
import { query, createAsync } from "@solidjs/router";

const getAccountStatsQuery = query(async () => {
// ... Fetches account statistics.
}, "accountStats");

const getRecentTransactionsQuery = query(async () => {
// ... Fetches a list of recent transactions.
}, "recentTransactions");

function Dashboard() {
const stats = createAsync(() => getAccountStatsQuery());
const transactions = createAsync(() => getRecentTransactionsQuery());

return (
<div>
<h1>Dashboard</h1>
<Suspense fallback={<p>Loading account stats...</p>}>
<For each={stats()}>
{(stat) => (
<p>
{stat.label}: {stat.value}
</p>
)}
</For>
</Suspense>

<Suspense fallback={<p>Loading recent transactions...</p>}>
<For each={transactions()}>
{(transaction) => (
<h2>
{transaction.description} - {transaction.amount}
</h2>
)}
</For>
</Suspense>
</div>
);
}
```

For example, each `<Suspense>` component creates its own independent boundary.
The server can stream the heading `<h1>Dashboard</h1>` immediately, while the `stats` and `transactions` are handled separately.
If the `transactions` query is slow, only its boundary will display a fallback, while `stats` will render as soon as its data is ready.

## When to disable streaming

While streaming is powerful, there are cases where it is better to wait for the data to load on the server.
In these situations, you can use the `deferStream` option in `createAsync`.

When `deferStream` is set to `true`, the server waits for the query to resolve before sending the initial HTML.

A common reason to disable streaming is for Search Engine Optimization (SEO).
Some search engine crawlers may not wait for streamed content to load.
If critical data, such as a page title or meta description, affects SEO, it should be included in the initial server response.

```tsx
import { query, createAsync } from "@solidjs/router";

const getArticleQuery = query(async () => {
// ... Fetches an article.
}, "article");

function ArticleHeader() {
const article = createAsync(() => getArticleQuery(), {
deferStream: true,
});

return <h1>{article()?.title}</h1>;
}
```
1 change: 1 addition & 0 deletions src/routes/solid-router/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"getting-started",
"concepts",
"rendering-modes",
"data-fetching",
"advanced-concepts",
"guides"
]
Expand Down
Loading