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

mixed.tsx

35 lines1.2 KB

1import { Title } from '@solidjs/meta'
2import { PostViewer } from '~/components/post-viewer'
3import { UserInfo } from '~/components/user-info'
4​
5export default function Mixed() {
6 return (
7 <main>
8 <Title>Solid Query - Mixed</Title>
9​
10 <h1>Solid Query - Mixed Example</h1>
11​
12 <div class="description">
13 <p>
14 You may want to require that key queries resolve before the initial
15 HTML is streamed to the client, while allowing the rest of your
16 queries to stream to the client as they resolve. A common use case for
17 this is to populate SEO meta tags and/or social graph information for
18 unfurl scenarios such as sharing the page as a link in Slack.
19 </p>
20​
21 <p>
22 In this example, the quick (100ms) user query has deferStream set to
23 true, while the more expensive post query (1000ms) is streamed to the
24 client when ready. Clients with javascript disabled will see the
25 resolved state for the user query, and the loading state for the post
26 query. (try turning off javascript and reloading this page)
27 </p>
28 </div>
29​
30 <UserInfo deferStream sleep={100} />
31​
32 <PostViewer sleep={1000} />
33 </main>
34 )