We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 98057c0 commit f3ccb31Copy full SHA for f3ccb31
@app/src/routes/+page.svelte
@@ -1,2 +1,9 @@
1
<script lang="ts">
2
+ export let data;
3
+ const queries = data.queries();
4
</script>
5
+
6
+<pre>
7
+{JSON.stringify($queries, null, 2)}
8
+</pre>
9
@app/src/routes/+page.ts
@@ -0,0 +1,15 @@
+import { trpc } from '$lib/trpc/client';
+export async function load(event) {
+ const { queryClient } = await event.parent();
+ const api = trpc(event, queryClient);
+ return {
+ queries: await api.createServerQueries((t) => [t.greeting('foo'), t.greeting('bar')], {
+ combine: (results) => ({
10
+ data: results.map(({ data }) => data),
11
+ pending: results.some(({ isPending }) => isPending),
12
+ }),
13
14
+ };
15
+}
0 commit comments