Skip to content

Commit eb87b58

Browse files
committed
remove deferStream example
1 parent 965e30a commit eb87b58

1 file changed

Lines changed: 0 additions & 33 deletions

File tree

src/routes/solid-router/reference/data-apis/create-async.mdx

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -167,39 +167,6 @@ function Recipes() {
167167
}
168168
```
169169

170-
### With `deferStream`
171-
172-
```tsx
173-
import { createAsync, query, redirect } from "@solidjs/router";
174-
175-
const getDashboardDataQuery = query(async () => {
176-
const res = await fetch("/api/dashboard");
177-
178-
if (res.status === 403) {
179-
throw redirect("/login");
180-
}
181-
182-
return res.json();
183-
}, "dashboard");
184-
185-
function Dashboard() {
186-
// Modifying response headers after streaming has started will cause an error.
187-
// Since getDashboardDataQuery may trigger a redirect, which requires updating
188-
// response headers, deferStream is used to ensure headers can still be modified
189-
// when needed.
190-
const data = createAsync(() => getDashboardDataQuery(), {
191-
deferStream: true,
192-
});
193-
194-
return (
195-
<div>
196-
<h1>Dashboard</h1>
197-
<p>Welcome back, {data()?.username}</p>
198-
</div>
199-
);
200-
}
201-
```
202-
203170
## Related
204171

205172
- [`query`](/solid-router/reference/data-apis/query)

0 commit comments

Comments
 (0)