Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

deferred.tsx

40 lines1.2 KB

1import { Title } from '@solidjs/meta'
2import { PostViewer } from '~/components/post-viewer'
3import { UserInfo } from '~/components/user-info'
4​
5export default function Deferred() {
6 return (
7 <main>
8 <Title>Solid Query - Deferred</Title>
9​
10 <h1>Solid Query - Deferred Example</h1>
11​
12 <div class="description">
13 <p>
14 Both queries are configured with deferStream=true, so the server will
15 not start streaming HTML to the client until the queries have
16 resolved. In this case we are not really taking advantage of streaming
17 - this mimics traditional renderAsync + Suspense behavior. Note how
18 the green bar in the devtools is much larger now - the client does not
19 start receiving any information until 2+ seconds (both queries
20 resolve).
21 </p>
22​
23 <p>
24 Clients with javascript disabled will see the resolved state for both
25 queries. (try turning off javascript and reloading this page)
26 </p>
27​
28 <img
29 class="description_img"
30 src="/imgs/deferred.png"
31 alt="devtools deferred requests"
32 />
33 </div>
34​
35 <UserInfo sleep={2000} deferStream />
36​
37 <PostViewer sleep={2000} deferStream />
38 </main>
39 )