You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Simplify load method, fix syntax highlighting
SvelteKit now automatically infers the type of an exported load method, so no need to manually define it.
Also, Github has an ongoing issue with the Svelte syntax highlighting so using `html` is a good fallback.
* Change back to using svelte for code blocks
---------
Co-authored-by: Lachlan Collins <1667261+lachlancollins@users.noreply.github.com>
Copy file name to clipboardExpand all lines: docs/svelte/ssr.md
+5-7Lines changed: 5 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -42,16 +42,16 @@ If you wish to view the ideal SSR setup, please have a look at the [SSR example]
42
42
Together with SvelteKit's [`load`](https://kit.svelte.dev/docs/load), you can pass the data loaded server-side into `createQuery`'s' `initialData` option:
43
43
44
44
**src/routes/+page.ts**
45
-
```ts
46
-
importtype { PageLoad } from'./$types'
47
45
48
-
exportconst load:PageLoad=async () => {
46
+
```ts
47
+
exportasyncfunction load() {
49
48
const posts =awaitgetPosts()
50
49
return { posts }
51
50
}
52
51
```
53
52
54
53
**src/routes/+page.svelte**
54
+
55
55
```svelte
56
56
<script>
57
57
import { createQuery } from '@tanstack/svelte-query'
@@ -88,7 +88,7 @@ Svelte Query supports prefetching queries on the server. Using this setup below,
0 commit comments