File tree Expand file tree Collapse file tree
src/routes/solid-router/reference/data-apis Expand file tree Collapse file tree Original file line number Diff line number Diff 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 )
You can’t perform that action at this time.
0 commit comments